Bug 143832

Summary: Can not generate pycache (.pyc) files on Windows as non-admin accounts
Product: LibreOffice Reporter: Ming Hua <ming.v.hua>
Component: InstallationAssignee: Not Assigned <libreoffice-bugs>
Status: UNCONFIRMED ---    
Severity: minor    
Priority: medium    
Version: 7.0.6.2 release   
Hardware: All   
OS: Windows (All)   
Whiteboard: QA:needsComment
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 127593    

Description Ming Hua 2021-08-12 09:00:14 UTC
Description:
It seems that the way current Windows MSI installer is set up, if LibreOffice is installed by an admin account to the default place (C:\Program Files\LibreOffice), a non-admin account can use the application perfectly fine, including Python scripting features, but the bundled Python can not generate the .pyc pycache files because the non-admin account doesn't have write permission for C:\Program Files\LibreOffice\program directory.

Presumably this will cause LibreOffice compiling to bytecode each time Python is used, and affect performance for heavy Python-scripting users.

Steps to reproduce:
1. Install LibreOffice on Windows using the MSI installer, either from an account with admin privileges, or from an ordinary account and provide password for admin when asked.  Use the default installation directory "C:\Program Files\LibreOffice", but anywhere else that ordinary users don't have write access should also be OK.

2. Do NOT start LibreOffice from the admin account.

3. Start LibreOffice from the ordinary non-admin account, run some Python sample macros that came with the installation.  Optionally one can also try some Python commands and macros from command line using the bundled Python.

4. Observe that no matter how Python is used, the directory supposed to store pycache files "C:\Program Files\LibreOffice\program\__pycache__" and "C:\Program Files\LibreOffice\program\python-core-<version>\lib\__pycache__" are not created, and the .pyc files are not generated.

Expected result:
Generate pycache files for non-admin account, somewhere in user profile, maybe?  Or alternatively the installation process can generate them as admin account?

Additional Information:
This is hard to test with parallel installation, so I only get this for my main 7.0.6 installation:
Version: 7.0.6.2 (x64)
Build ID: 144abb84a525d8e30c9dbbefa69cbbf2d8d4ae3b
CPU threads: 2; OS: Windows 10.0 Build 19043; UI render: default; VCL: win
Locale: zh-CN (zh_CN); UI: en-US
Calc: threaded
...but I don't think this has changed for 7.2 or master.