Error using etree in lxml

Sangamesh picture Sangamesh · Apr 30, 2013 · Viewed 19.8k times · Source

I want to use xpath in python . I tried

import xml.etree.ElementTree as ET

Since this library has limited usage I had to use lxml after a long session of search on google. I had several problems during installation and finally i installed lxml but when i use

from lxml import etree

it throws back an error as below. could you please tell me the solution to this problem!!!

Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
from lxml import etree
ImportError: DLL load failed: %1 is not a valid Win32 application.

Can any1 tell me what the problem would be?? Thanks for assistance!!

Answer

Xidh picture Xidh · Dec 22, 2016

I know that's late to say this... But may help someone someday..

I use the following code to solve the exact same problem here

python -m pip uninstall lxml
python -m pip install lxml==3.6.0