Perlence / AutoHotkey.py

Write AutoHotkey scripts in Python.
https://ahkpy.readthedocs.io
BSD 3-Clause "New" or "Revised" License
79 stars 12 forks source link

AutoHotkey.py can't load the Python DLL if Python is installed from Microsoft Store #15

Open Perlence opened 2 years ago

Perlence commented 2 years ago

The script errors out with Cannot load Python DLL: 5.

The user running the script is not an admin.

trajano commented 2 years ago

Seems like python_dll_path() works correctly.

>>> python_dll_path()
'C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.10_3.10.2032.0_x64__qbz5n2kfra8p0\\python310.dll'
Perlence commented 2 years ago

It does, but I had to use admin access to open that directory.

trajano commented 2 years ago

But you can access the file directly.

ls -l  'C:/Program Files/WindowsApps/PythonSoftwareFoundation.Python.3.10_3.10.2032.0_x64__qbz5n2kfra8p0/python3.dll'
trajano commented 2 years ago

I'm not exactly sure but it looks like if you want LOAD_WITH_ALTERED_SEARCH_PATH you should add the DLLs folder as well.

It's readable BTW

 ls -l  'C:/Program Files/WindowsApps/PythonSoftwareFoundation.Python.3.10_3.10.2032.0_x64__qbz5n2kfra8p0/DLLs/'*.dll

5 means access denied, but it's readable so the only thing I can think of is that it's not considered executable, but not sure if there's a specific thing for that in Windows.