Dear lxml community,
 
First of all, thank you for this great toolkit.
 
I ran into a very particular conflict which I was not able to solve and that might be of interest.
 
For a project I am using OBS (Open Broadcaster Software) that provides Python scripting capabilities to manipulate scenes, objects, etc. ( https://obsproject.com/wiki/Getting-Started-With-OBS-Scripting ). The API is in C and wrapper functions for Python are built by SWIG ( https://obsproject.com/docs/scripting.html ). When loading a Python script from within the OBS software containing nothing else but 'from lxml import etree', it throws an import error because of an undefined symbol. Outside of OBS lxml works as expected and no errors occur.
 
from lxml import etree

ImportError: /home/[USER]/.local/lib/python3.8/site-packages/lxml/etree.cpython-38-x86_64-linux-gnu.so: undefined symbol: PyExc_ImportError

Out of curiosity I tried to build lxml from source (which did not succeed) and stumbled upon something that might be related to that error. When Cythonizing src/lxml/etree.pyx warnings occur that the local variable 'args' is referenced before assigned (see below).

 

user@host:~/lxml-lxml-lxml-4.7.1-11-gac829d5/lxml-lxml-ac829d5$ python3 setup.py build --with-cython

Building lxml version 4.7.1.

Building with Cython 0.29.27.

Building against libxml2 2.9.10 and libxslt 1.1.34

Compiling src/lxml/etree.pyx because it changed.

Compiling src/lxml/objectify.pyx because it changed.

Compiling src/lxml/builder.py because it changed.

Compiling src/lxml/_elementpath.py because it changed.

Compiling src/lxml/html/diff.py because it changed.

Compiling src/lxml/html/clean.py because it changed.

Compiling src/lxml/sax.py because it changed.

[1/7] Cythonizing src/lxml/_elementpath.py

[2/7] Cythonizing src/lxml/builder.py

[3/7] Cythonizing src/lxml/etree.pyx

warning: src/lxml/xmlerror.pxi:657:22: local variable 'args' referenced before assignment

warning: src/lxml/xmlerror.pxi:658:69: local variable 'args' referenced before assignment

warning: src/lxml/xmlerror.pxi:659:20: local variable 'args' referenced before assignment

warning: src/lxml/xmlerror.pxi:664:22: local variable 'args' referenced before assignment

warning: src/lxml/xmlerror.pxi:665:73: local variable 'args' referenced before assignment

warning: src/lxml/xmlerror.pxi:666:20: local variable 'args' referenced before assignment

warning: src/lxml/xmlerror.pxi:671:22: local variable 'args' referenced before assignment

warning: src/lxml/xmlerror.pxi:672:73: local variable 'args' referenced before assignment

warning: src/lxml/xmlerror.pxi:673:20: local variable 'args' referenced before assignment

[4/7] Cythonizing src/lxml/html/clean.py

[5/7] Cythonizing src/lxml/html/diff.py

[6/7] Cythonizing src/lxml/objectify.pyx

[7/7] Cythonizing src/lxml/sax.py

 

System information:

 
OS                      : Ubuntu 20.04
OBS                    : 25.0.3+dfsg1-2
 
Python                : sys.version_info(major=3, minor=8, micro=10, releaselevel='final', serial=0)
lxml.etree           : (4, 7, 1, 0)
libxml used         : (2, 9, 12)
libxml compiled   : (2, 9, 12)
libxslt used          : (1, 1, 34)
libxslt compiled   : (1, 1, 34)
 
I am aware that the libxml versions differ (2.9.10 on my machine, 2.9.12 for lxml) but would expect this to throw an error regardless of importing it in a default or OBS Python environment, if that would be the issue. Unfortunately I do not know how the Python environment inside OBS differs from a regular one. In order to reproduce this conflict, one would need to install OBS on their Linux machine.
 
For any hint on this I would be very glad.
Kind regards,
Daniel

 

 
 
_______________________________________________
lxml - The Python XML Toolkit mailing list -- lxml@python.org
To unsubscribe send an email to lxml-le...@python.org
https://mail.python.org/mailman3/lists/lxml.python.org/
Member address: arch...@mail-archive.com

Reply via email to