Description: Python macros stored in user profile can't be run. Steps to Reproduce: 1. Copy sample python script file "HelloWorld.py" from directory share of LO instalation to directory Script/python/ on user profile. 2. Open a new text document. 3. Try to run copied python macro ("HelloWorldPyton") from user location. Actual Results: An error message appears: pyuno._createUnoStructHelper: member 'Context' of struct type 'com.sun.star.uno.Exception' not given a value. Expected Results: Inserted text "Hello World (in Python)" in document. Reproducible: Always User Profile Reset: Yes Additional Info: Tested in windows 7 Versión: 6.0.4.2 Id. de compilación: 9b0d9b32d5dcda91d2f1a96dc04c645c450872bf Subprocs. CPU: 2; SO: Windows 6.1; Repres. IU: predet.; Configuración regional: es-ES (es_ES); Calc: group
No problem for me on Windows or Linux. Tried 6.0.4 and master. Directory name should be Scripts/python and not Script/python. Then the scripts appear in My Macros.
I can confirm with Version: 6.2.0.0.alpha0+ (x64) Build ID: 7e8dbbb02f25278d5afc51ae4a397831f5b21239 CPU threads: 1; OS: Windows 6.1; UI render: default; TinderBox: Win-x86_64@42, Branch:master, Time: 2018-07-15_02:52:05 path C:\Users\user\AppData\Roaming\LibreOfficeDev\4\user\scripts\python
@raal, any chance you could try this with previous versions of LibreOffice ?
If case of directory name is not exactly "Scripts/python" (S in uppercase and rest in lowercase) then the python scripts are displayed correctly (files and functions) but don't run and appears the indicated error message. In my working environment (Windows 7 with PCs conected to domain) the user profile is stored in D: drive so user python scripts are stored in D:\Usuarios\nombre_usuario\AppData\Roaming\LibreOffice\4\user\Scripts\python Tested with local user and profile stored in C: drive the issue is not present.
Hi Luis, Please provide us with the output of the following commands in the Python shell: import sys sys.path HINT Running the Python interactive console: https://help.libreoffice.org/6.4/en-US/text/sbasic/python/python_shell.html
Hi Alain I am currently working at home. I can't provide the requested information from my corporate environment. When I can resume work in my office, I will post the information.
Hi Alain: Test done in my working environment (now windows 10) with recent development version 7.1.0.0.alpha0+ (x86) Version: 7.1.0.0.alpha0+ (x86) Build ID: 8ed11b7289533bd609fbcb2adfb7b2982ef6fe22 CPU threads: 4; OS: Windows 10.0 Build 17763; UI render: Skia/Raster; VCL: win Locale: es-ES (es_ES); UI: en-US Calc: CL In this versión if case of directory name is not exactly "Scripts/python" then the python scripts are displayed correctly (files and functions) but the run button is disabled. The results of the python shell are: Python 3.7.7 (heads/master-dirty:8ed11b728953, Jun 28 2020, 02:29:02) [MSC v.1925 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> sys.path ['', 'D:\\LO7\\program', 'D:\\LO7\\program\\python-core-3.7.7\\lib', 'D:\\LO7\\program\\python-core-3.7.7\\lib\\site-packages', 'D:\\LO7\\program\\python37.zip', 'D:\\LO7\\program\\python-core-3.7.7\\DLLs', 'D:\\LO7\\program\\python-core-3.7.7\\bin', 'D:\\LO7\\program\\python-core-3.7.7'] >>>
<UserProfile>/Scripts/python should be appended to Python sys.path in this context
Dear Luis, 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
Alain, so it's a bug or not a bug at all? If I understood correctly we have only one place for Python scripts placing and it's just by default. If user want start his/her Python scripts in LibreOffice from any other place then he/she should just add a new place to Python sys.path him/herself, right?
@Roman: its not a bug, and your assumptions (and of course @Alains assumptions) are wrong. sys.path defines the folders where python search for »some_module« if you execute somewhere in your script »import some_module« … nothing else. but this import-mechanism is almost independent from the generated Dialog in the GUI which populates the available python-functions to the user. the initial issue was the wrong »…/Script/python/…« instead »…/Scripts/python/…«
I tried with Script/python, Scripts/python, and scripts/python, on my Windows 10, using Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community Build ID: c7b59c9484ae6ff88cd8d7017aeb83b02e212c9c CPU threads: 12; OS: Windows 10.0 Build 19045; UI render: Skia/Raster; VCL: win Locale: ru-RU (ru_RU); UI: en-US Calc: CL threaded I expectedly do not see any user scripts in the Python Macros dialog (Tools->Macros->Organize Macros->Python) in the Script/python case; I see the HelloWorld/HelloWorldPython under My Macros with both Scripts/python, and scripts/python; and both of them run OK (producing the respective text in the text document). The path to the python file is C:\lo\src\build\instdir\user\Scripts\python\HelloWorld.py (so on drive C:, testing comment 2), and also I tested with D:\my-test-profile\user\Scripts\python\HelloWorld.py (to check comment 4). Is it WORKSFORME?