You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I run my_app.py, it works fine. But when I run my_app.exe built with PyInstaller, I encounter an error:
./my_app.exe
Traceback (most recent call last):
File "my_app.py", line 7, in
File "", line 1360, in _find_and_load
File "", line 1331, in _find_and_load_unlocked
File "", line 935, in _load_unlocked
File "PyInstaller\loader\pyimod02_importers.py", line 378, in exec_module
File "server.py", line 4, in
File "", line 1360, in _find_and_load
File "", line 1331, in _find_and_load_unlocked
File "", line 935, in _load_unlocked
File "PyInstaller\loader\pyimod02_importers.py", line 378, in exec_module
File "tools.py", line 3, in
File "", line 1360, in _find_and_load
File "", line 1331, in find_and_load_unlocked
File "", line 935, in load_unlocked
File "PyInstaller\loader\pyimod02_importers.py", line 378, in exec_module
File "hl7apy_init.py", line 334, in
File "hl7apy_init.py", line 331, in _discover_libraries
FileNotFoundError: [WinError 3] System nie może odnaleźć określonej ścieżki: 'C:\Users\user~1\AppData\Local\Temp\_MEI86002\hl7apy'
[PYI-15820:ERROR] Failed to execute script 'my_app' due to unhandled exception!
A workaround is to use the --add-data clause during the build process:
pyinstaller my_app.py --onefile --add-data "C:\venv\Lib\site-packages\hl7apy;hl7apy"
However, this solution isn't ideal.
I suspect the issue might lie in the _discover_libraries function.
Could you please fix it?
The text was updated successfully, but these errors were encountered:
Hi @paw-bor,
I have no experience with PyInstaller so I don't know what the problem is with it or if it is caused by the library. May it be the --onefile option? The discover_libraries function uses os.path functions to check the versions' directories in a dynamic way so if everything is packed together it won't find the directories.
Hi @svituz
Yes, I think the problem is due to the --onefile option.
As far as I know, the __file__ doesn't work correctly within the PyInstaller environment. Therefore, we should use the _MEIPASS directory to access the application's resources.
I think, the solution might be to modify the discover_libraries function as follows:
When I run my_app.py, it works fine. But when I run my_app.exe built with PyInstaller, I encounter an error:
./my_app.exe
Traceback (most recent call last):
File "my_app.py", line 7, in
File "", line 1360, in _find_and_load
File "", line 1331, in _find_and_load_unlocked
File "", line 935, in _load_unlocked
File "PyInstaller\loader\pyimod02_importers.py", line 378, in exec_module
File "server.py", line 4, in
File "", line 1360, in _find_and_load
File "", line 1331, in _find_and_load_unlocked
File "", line 935, in _load_unlocked
File "PyInstaller\loader\pyimod02_importers.py", line 378, in exec_module
File "tools.py", line 3, in
File "", line 1360, in _find_and_load
File "", line 1331, in find_and_load_unlocked
File "", line 935, in load_unlocked
File "PyInstaller\loader\pyimod02_importers.py", line 378, in exec_module
File "hl7apy_init.py", line 334, in
File "hl7apy_init.py", line 331, in _discover_libraries
FileNotFoundError: [WinError 3] System nie może odnaleźć określonej ścieżki: 'C:\Users\user~1\AppData\Local\Temp\_MEI86002\hl7apy'
[PYI-15820:ERROR] Failed to execute script 'my_app' due to unhandled exception!
A workaround is to use the --add-data clause during the build process:
pyinstaller my_app.py --onefile --add-data "C:\venv\Lib\site-packages\hl7apy;hl7apy"
However, this solution isn't ideal.
I suspect the issue might lie in the _discover_libraries function.
Could you please fix it?
The text was updated successfully, but these errors were encountered: