Bug 136001 - Python import fails: No module named 'com'
Summary: Python import fails: No module named 'com'
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
6.4.6.2 release
Hardware: x86-64 (AMD64) All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: possibleRegression
Depends on:
Blocks: UNO
  Show dependency treegraph
 
Reported: 2020-08-21 22:22 UTC by Jens Troeger
Modified: 2025-05-24 03:12 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jens Troeger 2020-08-21 22:22:39 UTC
Description:
We have just updated to LibreOffice 6.4.6.2 40(Build:2), and now Python’s modules fail to import:

$ PYTHONPATH=/usr/lib64/libreoffice/program/ python3.8
Python 3.8.5 (default, Aug 21 2020, 13:17:56) 
[GCC 9.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import uno
>>> from com.sun.star.text import ReferenceFieldSource
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/libreoffice/program/uno.py", line 436, in _uno_import
    raise uno_import_exc
  File "/usr/lib64/libreoffice/program/uno.py", line 358, in _uno_import
    return _builtin_import(name, *optargs, **kwargs)
ImportError: No module named 'com' (or 'com.sun.star.text.ReferenceFieldSource' is unknown)
>>> 

Same with Python 3.7. Now rolling back to 6.4.5.2 which hopefully fixes the issue. 

Is this a regression? Something I’m missing? Anything changed here? I noticed that 6.4.6.2 is not listed below as an “official” release?

Steps to Reproduce:
See above.

Actual Results:
Python import exception.

Expected Results:
Successful import of Python modules.


Reproducible: Always


User Profile Reset: Yes



Additional Info:
Built LO on a Gentoo box:

[ebuild   R    ] app-office/libreoffice-6.4.6.2::gentoo  USE="dbus mariadb postgres -accessibility -base -bluetooth -branding -coinmp -cups -debug -eds -firebird -googledrive -gstreamer -gtk -java -kde -ldap -odk -pdfimport -test" LIBREOFFICE_EXTENSIONS="-nlpsolver -scripting-beanshell -scripting-javascript -wiki-publisher" PYTHON_SINGLE_TARGET="python3_7 -python3_6 -python3_8 -python3_9" 0 KiB
Comment 1 Kevin Suo 2020-10-21 06:21:10 UTC Comment hidden (obsolete)
Comment 2 Kevin Suo 2020-10-22 07:34:13 UTC
I do reproduce with version 6.4.6.2 release and also on libreoffice-7-0 branch, when running:
from com.sun.star.text import ReferenceFieldSource.

The first import, "import uno" is successful.
Comment 3 Kevin Suo 2020-10-23 09:31:48 UTC
The import of com.sun.start.* is successful when I use the python shell with the following extension:
https://extensions.libreoffice.org/en/extensions/show/apso-alternative-script-organizer-for-python
Comment 4 Julien Nabet 2022-01-22 16:38:35 UTC
On pc Debian x86-64 with master sources updated today, I don't reproduce this.
Python 3.8.12 (default, Jan 22 2022, 17:24:40) 
[Clang 13.0.1 ] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import uno
>>> from com.sun.star.text import ReferenceFieldSource
>>> 

Debian testing provides LO 7.3.0.2, I don't see any Python binary in a "libreoffice" subdir in "/usr" so can't test it.
Comment 5 Werner Tietz 2022-10-29 12:43:29 UTC
@Julien Nabet
the python-interpreter on Debian (also linked to LO ) is: /usr/bin/python
Comment 6 Werner Tietz 2022-10-29 12:45:05 UTC Comment hidden (obsolete)
Comment 7 QA Administrators 2025-05-24 03:12:07 UTC
Dear Jens Troeger,

To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year.

There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present.

If you have time, please do the following:

Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/

If the bug is present, please leave a comment that includes the information from Help - About LibreOffice.
 
If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice.

Please DO NOT

Update the version field
Reply via email (please reply directly on the bug tracker)
Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not 
appropriate in this case)


If you want to do more to help you can test to see if your issue is a REGRESSION. To do so:
1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from https://downloadarchive.documentfoundation.org/libreoffice/old/

2. Test your bug
3. Leave a comment with your results.
4a. If the bug was present with 3.3 - set version to 'inherited from OOo';
4b. If the bug was not present in 3.3 - add 'regression' to keyword


Feel free to come ask questions or to say hello in our QA chat: https://web.libera.chat/?settings=#libreoffice-qa

Thank you for helping us make LibreOffice even better for everyone!

Warm Regards,
QA Team

MassPing-UntouchedBug