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
Context
- Import python module · jan
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.