[Libreoffice-bugs] [Bug 133123] New: Pyhon module uno.py overrides import, resulting in failure of subsequent import cairosvg module
bugzilla-daemon at bugs.documentfoundation.org
bugzilla-daemon at bugs.documentfoundation.org
Sun May 17 14:56:42 UTC 2020
https://bugs.documentfoundation.org/show_bug.cgi?id=133123
Bug ID: 133123
Summary: Pyhon module uno.py overrides import, resulting in
failure of subsequent import cairosvg module
Product: LibreOffice
Version: 6.4.3.2 release
Hardware: All
OS: Linux (All)
Status: UNCONFIRMED
Severity: normal
Priority: medium
Component: sdk
Assignee: libreoffice-bugs at lists.freedesktop.org
Reporter: spljaa at gmail.com
Description:
Python module uno.py overrides import. And that overwritten function fails to
import some modules. Cairosvg is one example.
Workaround is to import carirosvg before libreoffice ones.
It looks like sys.modules can contain entry for module with value None. Maybe
simple check against that would work. Or maybe there is needed other approach
with Python 3.8?
Steps to Reproduce:
Simle code like:
import uno
import cairosvg
After failure it looks like sys.modules["_elementtree"] is None.
(Key exists in that dict, but with None as value)
Actual Results:
Traceback (most recent call last):
File "test.py", line 2, in <module>
import cairosvg
File "/usr/lib64/python3.8/site-packages/uno.py", line 359, in _uno_import
return _builtin_import(name, *optargs, **kwargs)
File "/usr/lib/python3.8/site-packages/cairosvg/__init__.py", line 42, in
<module>
from . import surface # noqa isort:skip
File "/usr/lib64/python3.8/site-packages/uno.py", line 359, in _uno_import
return _builtin_import(name, *optargs, **kwargs)
File "/usr/lib/python3.8/site-packages/cairosvg/surface.py", line 28, in
<module>
from .defs import (
File "/usr/lib64/python3.8/site-packages/uno.py", line 359, in _uno_import
return _builtin_import(name, *optargs, **kwargs)
File "/usr/lib/python3.8/site-packages/cairosvg/defs.py", line 24, in
<module>
from .bounding_box import calculate_bounding_box, is_non_empty_bounding_box
File "/usr/lib64/python3.8/site-packages/uno.py", line 359, in _uno_import
return _builtin_import(name, *optargs, **kwargs)
File "/usr/lib/python3.8/site-packages/cairosvg/bounding_box.py", line 28, in
<module>
from .parser import Tree
File "/usr/lib64/python3.8/site-packages/uno.py", line 359, in _uno_import
return _builtin_import(name, *optargs, **kwargs)
File "/usr/lib/python3.8/site-packages/cairosvg/parser.py", line 28, in
<module>
from defusedxml import ElementTree
File "/usr/lib64/python3.8/site-packages/uno.py", line 359, in _uno_import
return _builtin_import(name, *optargs, **kwargs)
File "/usr/lib/python3.8/site-packages/defusedxml/ElementTree.py", line 63,
in <module>
_XMLParser, _iterparse, ParseError = _get_py3_cls()
File "/usr/lib/python3.8/site-packages/defusedxml/ElementTree.py", line 48,
in _get_py3_cls
pure_pymod = importlib.import_module(pymodname)
File "/usr/lib64/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/usr/lib64/python3.8/xml/etree/ElementTree.py", line 2053, in <module>
from _elementtree import *
File "/usr/lib64/python3.8/site-packages/uno.py", line 383, in _uno_import
d = mod.__dict__
AttributeError: 'NoneType' object has no attribute '__dict__'
Expected Results:
Proper import of cairosvg, with modules it imports.
Workaround is to use:
import cairosvg
import uno
Reproducible: Always
User Profile Reset: Yes
Additional Info:
Python 3.8.2
libreoffice-pyuno-6.4.3.2-1.fc32.x86_64
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20200517/882a2173/attachment-0001.htm>
More information about the Libreoffice-bugs
mailing list