Python 3.4 : How to do xml validation -
i'm trying xml validation against xsd in python. successful using lxml package. problem starts when tried port code python 3.4. tried install lxml 3.4 version. looks enterprise linux doesn't play lxml.
pip installation:
pip install lxml collecting lxml downloading lxml-3.4.4.tar.gz (3.5mb) 100% |################################| 3.5mb 92kb/s installing collected packages: lxml running setup.py install lxml installed lxml-3.4.4 after pip installation :
> python python 3.4.1 (default, nov 12 2014, 13:34:29) [gcc 4.1.2 20080704 (red hat 4.1.2-48)] on linux type "help", "copyright", "credits" or "license" more information. >>> lxml import etree traceback (most recent call last): file "<stdin>", line 1, in <module> importerror: /ws/satjonna-sjc/pyats/lib/python3.4/site-packages/lxml/etree.cpython-34m.so: undefined symbol: xmlmemdisplaylast >>> git installation:
git clone git://github.com/lxml/lxml.git lxml cloning 'lxml'... remote: counting objects: 25078, done. remote: total 25078 (delta 0), reused 0 (delta 0), pack-reused 25078 receiving objects: 100% (25078/25078), 21.38 mib | 2.66 mib/s, done. resolving deltas: 100% (9854/9854), done. checking connectivity... done. after git installation :
> python python 3.4.1 (default, nov 12 2014, 13:34:29) [gcc 4.1.2 20080704 (red hat 4.1.2-48)] on linux type "help", "copyright", "credits" or "license" more information. >>> lxml import etree traceback (most recent call last): file "<stdin>", line 1, in <module> importerror: cannot import name 'etree' i found lxml equivalent xml.etree.elementtree. main problem apart rewriting entire code, need find xml.etree alternative lxml validation moethod ( etree.fromstring(xmlstring, xmlparser) ). suggestions make work helpful.
just sake of troubleshooting, did run pip install lxml administrator? , libxml2 , libxslt dependencies installed?
this installation page: http://lxml.de/installation.html
on linux (and other well-behaved operating systems), pip manage build source distribution long libxml2 , libxslt installed, including development packages, i.e. header files, etc. see requirements section above , use system package management tool packages libxml2-dev or libxslt-devel. if build fails, make sure installed. alternatively, setting static_deps=true download , build both libraries automatically in latest version, e.g. static_deps=true pip install lxml.
Comments
Post a Comment