Hello,

lxml    library is not linked properly in Eclipse/PyDev, but it's ok in
the command shell.

system: Debian/Squeeze
Eclipse: 3.5.2 - installed via Synaptic debian package manager
PyDev: 1.5.9.2010063001

lxml: 2.2.6-1 - installed via Synaptic debian package manager
(python-lxml package)

The lxml has been installed to two different locations, where some of
the files (is that the problem??? !!!) are links to the second place.
Let's see how it's installed:

ls -l /usr/lib/python2.6/dist-packages/
drwxr-xr-x  3 root root   4096  4. čec 23.22 lxml
lrwxrwxrwx  1 root root     39  4. čec 23.22 lxml-2.2.6.egg-info ->
/usr/share/pyshared/lxml-2.2.6.egg-info

ls -l /usr/share/pyshared/
drwxr-xr-x  3 root root   4096  4. čec 23.22 lxml
-rw-r--r--  1 root root   2660 10. bře 11.40 lxml-2.2.6.egg-info

ls -l /usr/lib/python2.6/dist-packages/lxml/
lrwxrwxrwx 1 root root      35  4. čec 23.22 builder.py ->
/usr/share/pyshared/lxml/builder.py
-rw-r--r-- 1 root root    6643  4. čec 23.22 builder.pyc
lrwxrwxrwx 1 root root      37  4. čec 23.22 cssselect.py ->
/usr/share/pyshared/lxml/cssselect.py
-rw-r--r-- 1 root root   33223  4. čec 23.22 cssselect.pyc
lrwxrwxrwx 1 root root      42  4. čec 23.22 doctestcompare.py ->
/usr/share/pyshared/lxml/doctestcompare.py
-rw-r--r-- 1 root root   17263  4. čec 23.22 doctestcompare.pyc
lrwxrwxrwx 1 root root      42  4. čec 23.22 ElementInclude.py ->
/usr/share/pyshared/lxml/ElementInclude.py
-rw-r--r-- 1 root root    4477  4. čec 23.22 ElementInclude.pyc
lrwxrwxrwx 1 root root      40  4. čec 23.22 _elementpath.py ->
/usr/share/pyshared/lxml/_elementpath.py
-rw-r--r-- 1 root root    5842  4. čec 23.22 _elementpath.pyc
-rw-r--r-- 1 root root 1036644 10. bře 11.40 etree.so
drwxr-xr-x 2 root root    4096  4. čec 23.22 html
lrwxrwxrwx 1 root root      36  4. čec 23.22 __init__.py ->
/usr/share/pyshared/lxml/__init__.py
-rw-r--r-- 1 root root     136  4. čec 23.22 __init__.pyc
-rw-r--r-- 1 root root  271856 10. bře 11.40 objectify.so
lrwxrwxrwx 1 root root      41  4. čec 23.22 pyclasslookup.py ->
/usr/share/pyshared/lxml/pyclasslookup.py
-rw-r--r-- 1 root root     211  4. čec 23.22 pyclasslookup.pyc
lrwxrwxrwx 1 root root      31  4. čec 23.22 sax.py ->
/usr/share/pyshared/lxml/sax.py
-rw-r--r-- 1 root root    8582  4. čec 23.22 sax.pyc
lrwxrwxrwx 1 root root      38  4. čec 23.22 usedoctest.py ->
/usr/share/pyshared/lxml/usedoctest.py
-rw-r--r-- 1 root root     425  4. čec 23.22 usedoctest.pyc

ls -l /usr/share/pyshared/lxml/
-rw-r--r-- 1 root root  7637 11. zář  2009 builder.py
-rw-r--r-- 1 root root 30312 13. lis  2009 cssselect.py
-rw-r--r-- 1 root root 18287 11. zář  2009 doctestcompare.py
-rw-r--r-- 1 root root  7641 11. zář  2009 ElementInclude.py
-rw-r--r-- 1 root root  6407 11. zář  2009 _elementpath.py
drwxr-xr-x 2 root root  4096  4. čec 23.22 html
-rw-r--r-- 1 root root    21 11. zář  2009 __init__.py
-rw-r--r-- 1 root root    87 11. zář  2009 pyclasslookup.py
-rw-r--r-- 1 root root  8229 11. zář  2009 sax.py
-rw-r--r-- 1 root root   230 11. zář  2009 usedoctest.py

Note, that in the pyshared location is missing the element tree !!!

Let's see, difference between command shell and the Eclipse shell:

Python in Command Shell (OK):
Python 2.6.5+ (release26-maint, Jul  1 2010, 00:47:18)
[GCC 4.4.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>  import lxml
>>>  lxml
<module 'lxml' from '/usr/lib/python2.6/dist-packages/lxml/__init__.pyc'>
>>>  from lxml import etree
>>>  etree
<module 'lxml.etree' from '/usr/lib/python2.6/dist-packages/lxml/etree.so'>
>>>


Eclipse's PyDev console (WRONG):
/usr/bin/python2.6 2.6.5+ (release26-maint, Jul  1 2010, 00:47:18)
[GCC 4.4.4]
>>>  import lxml
>>>  lxml
<module 'lxml' from '/usr/share/pyshared/lxml/__init__.py'>
>>>  from lxml import etree
Traceback (most recent call last):
   File "<console>", line 1, in<module>
ImportError: cannot import name etree
>>>

As we can see, there is a difference from where the lxml is loaded, so
my suggestion is, that the Eclipse/PyDev is following the file links
"too much" :(


Here is the PYTHONPATH from Eclipse:
/home/yatuga/.eclipse/org.eclipse.platform_3.5.0_155965261/plugins/org.python.pydev_1.5.9.2010063001/PySrc
/usr/lib/pymodules/python2.6
/usr/lib/python2.5/site-packages/lxml
/usr/lib/python2.6/lib-old
/usr/lib/python2.6/lib-dynload
/home/yatuga/work/Shop/Invoices/src
/usr/lib/python2.6/plat-linux2
/usr/lib/python2.6/dist-packages/lxml
/usr/lib/python2.6/lib-tk
/usr/share/pyshared
/usr/lib/pymodules/python2.6/gtk-2.0
/usr/lib/python2.6
/usr/lib/python2.6/dist-packages
/usr/lib/python2.6/dist-packages/PIL
/usr/lib/python2.6/dist-packages/gst-0.10
/usr/local/lib/python2.6/dist-packages

And here from command shell:
/home/yatuga/~/PythonTest
/usr/lib/python2.6
/usr/lib/python2.6/plat-linux2
/usr/lib/python2.6/lib-tk
/usr/lib/python2.6/lib-old
/usr/lib/python2.6/lib-dynload
/usr/lib/python2.6/dist-packages
/usr/lib/python2.6/dist-packages/PIL
/usr/lib/python2.6/dist-packages/gst-0.10
/usr/lib/pymodules/python2.6
/usr/lib/pymodules/python2.6/gtk-2.0
/usr/local/lib/python2.6/dist-packages

I also tried to add /usr/lib/python2.6/dist-packages/lxml to the
PYTHONPATH, but with no success. It still follows links to pyshared and
etree module is still unknown.

What I want:
1) find some clean solution for this problem, if possible
2) post bug report to the right place Eclipse or PyDev or python-lxml
deb package creator

Thank you for any suggestions and help with this.
Best Regards,
p47l4f0n


------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Pydev-users mailing list
Pydev-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pydev-users

Reply via email to