Bug 151695 - Errors when Running Scripts separately from the LibreOffice process
Summary: Errors when Running Scripts separately from the LibreOffice process
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
7.3.6.2 release
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Rafael Lima
URL:
Whiteboard: target:24.2.0
Keywords:
Depends on:
Blocks:
 
Reported: 2022-10-21 23:40 UTC by Paul Smith
Modified: 2023-07-21 11:58 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 Paul Smith 2022-10-21 23:40:13 UTC
Description:
I do the following:

libreoffice --calc --accept='socket,host=localhost,port=2021;urp;'
cd /usr/lib64/libreoffice/program
python

I then I get this error:

>>> from scriptforge import ScriptForge, CreateScriptService
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/libreoffice/program/scriptforge.py", line 57, in <module>
    import uno
  File "/usr/lib64/python3.10/site-packages/uno.py", line 32, in <module>
    _component_context = pyuno.getComponentContext()
SystemError: Error during bootstrapping uno (RuntimeException):URI libuno_cppuhelpergcc3.so.3 is expected to contain a slash /builddir/build/BUILD/libreoffice-7.3.6.2/cppuhelper/source/paths.cxx:44
>>> 

Could you please help me?




Steps to Reproduce:
I do the following:

libreoffice --calc --accept='socket,host=localhost,port=2021;urp;'
cd /usr/lib64/libreoffice/program
python

I then I get this error:

>>> from scriptforge import ScriptForge, CreateScriptService
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/libreoffice/program/scriptforge.py", line 57, in <module>
    import uno
  File "/usr/lib64/python3.10/site-packages/uno.py", line 32, in <module>
    _component_context = pyuno.getComponentContext()
SystemError: Error during bootstrapping uno (RuntimeException):URI libuno_cppuhelpergcc3.so.3 is expected to contain a slash /builddir/build/BUILD/libreoffice-7.3.6.2/cppuhelper/source/paths.cxx:44
>>> 

Could you please help me?




Actual Results:

>>> from scriptforge import ScriptForge, CreateScriptService
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/libreoffice/program/scriptforge.py", line 57, in <module>
    import uno
  File "/usr/lib64/python3.10/site-packages/uno.py", line 32, in <module>
    _component_context = pyuno.getComponentContext()
SystemError: Error during bootstrapping uno (RuntimeException):URI libuno_cppuhelpergcc3.so.3 is expected to contain a slash /builddir/build/BUILD/libreoffice-7.3.6.2/cppuhelper/source/paths.cxx:44
>>> 


Expected Results:
No error.


Reproducible: Always


User Profile Reset: No

Additional Info:
Comment 1 Buovjaga 2023-02-27 13:32:06 UTC
(In reply to Paul Smith from comment #0)
> Description:
> I do the following:
> 
> libreoffice --calc --accept='socket,host=localhost,port=2021;urp;'
> cd /usr/lib64/libreoffice/program
> python

What exactly are you doing here? You just run python REPL and it gives you the error? I don't understand.
Comment 2 Rafael Lima 2023-07-18 22:37:42 UTC
I just stumbled upon this issue... I guess the reason you're getting this error is because you're using your OS python interpreter instead of using LibreOffice's own python interpreter.

In this case, you need to set the proper PYTHONPATH

export PYTHONPATH=/usr/lib/libreoffice/program:/usr/lib/python3/dist-packages

Note:
/usr/lib/libreoffice/program   --> this is where scriptforge.py is located
/usr/lib/python3/dist-packages --> this is where uno.py is located

So you need to set this first before launching the interpreter.

I'll update the help page accordingly:
https://help.libreoffice.org/latest/en-US/text/sbasic/shared/03/sf_intro.html

In summary, this is not a bug in ScriptForge nor LibreOffice... but an improvement in documentation is required.
Comment 3 Commit Notification 2023-07-21 11:55:21 UTC
Rafael Lima committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/help/commit/e639a07cb41318324867952f5ef0d81dbda54236

tdf#151695 Improve documentation on setting PYTHONPATH