Import python module
jan
dittrich.c.jan at gmail.com
Fri May 26 15:28:27 UTC 2017
Hello LibO devs,
I have problems importing a python module.
Context: The main python script is in the folder [my home
directory].config/libreoffice/4/user/Scripts/python/somesubfolder/src
named "Test_embed.py"
Also in this folder, I placed another python file (qdahelpers.py) which
I want to import into Test_embed.py, using "import qdahelpers"
System: Ubuntu 16.04 with LO 5.3
What happens: The main script appears in the Tools/Macros/Run Macro…
dialog (the script to be imported, too). If I run the main Test_embed
via the dialog I get the following message:
> A Scripting Framework error occurred while running the Python script vnd.sun.star.script:myDocEmbed|src|Test_embed.py$Run_Test_embed?language=Python&location=user.
>
> Message: <class 'ImportError'>: No module named 'qdahelpers'
> File "/usr/lib/libreoffice/program/pythonscript.py", line 998, in getScript
> mod = self.provCtx.getModuleByUrl( fileUri )
Is it not possible to import python files in this way when using them in
Libreoffice? Or is the file executed in another context than the folder
it resides in? If yes, is there a way how I can import nevertheless?
Kind Regards,
Jan
More information about the LibreOffice
mailing list