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
I can't get Loguru to work with pyinstaller. Maybe someone can help me out.
Running the python file directly works perfectly fine and packaging with pyinstaller also works, but running the pyinstaller package then throws an Error.
Write a simple script test.py with the following contents:
from loguru import logger
print("test")
logger.debug("Testlog")
Pack it with pyinstaller:
pyinstaller test.py
Run the pyinstaller package
./dist/test/test
I'm then met with the following error:
Traceback (most recent call last):
File "test.py", line 1, in <module>
File "/home/user/Documents/pyinstaller-test/.venv/lib/python3.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 627, in exec_module
exec(bytecode, module.__dict__)
File "loguru/__init__.py", line 10, in <module>
File "/home/user/Documents/pyinstaller-test/.venv/lib/python3.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 627, in exec_module
exec(bytecode, module.__dict__)
File "loguru/_logger.py", line 18, in <module>
File "/home/user/Documents/pyinstaller-test/.venv/lib/python3.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 627, in exec_module
exec(bytecode, module.__dict__)
File "loguru/_better_exceptions.py", line 2, in <module>
ModuleNotFoundError: No module named 'distutils'
[105097] Failed to execute script test
When I use pyinstaller with the --hidden-import=distutils flag, it doesn't work either but just gives me this error instead:
Traceback (most recent call last):
File "test.py", line 1, in <module>
File "/home/user/Documents/pyinstaller-test/.venv/lib/python3.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 627, in exec_module
exec(bytecode, module.__dict__)
File "loguru/__init__.py", line 10, in <module>
File "/home/user/Documents/pyinstaller-test/.venv/lib/python3.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 627, in exec_module
exec(bytecode, module.__dict__)
File "loguru/_logger.py", line 18, in <module>
File "/home/user/Documents/pyinstaller-test/.venv/lib/python3.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 627, in exec_module
exec(bytecode, module.__dict__)
File "loguru/_better_exceptions.py", line 2, in <module>
File "/home/user/Documents/pyinstaller-test/.venv/lib/python3.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 627, in exec_module
exec(bytecode, module.__dict__)
File "distutils/__init__.py", line 44, in <module>
ImportError: cannot import name 'dist' from 'distutils' (/home/user/Documents/pyinstaller-test/dist/test/distutils/__init__.pyc)
[104459] Failed to execute script test
I didn't yet come further than this...
Would greatly appreciate any help!
Thank you!
The text was updated successfully, but these errors were encountered:
As distutils is not fundamentally required for loguru to work correctly, I will probably add a try / except block around the import distutils, just in case. 🙂
I can't get Loguru to work with pyinstaller. Maybe someone can help me out.
Running the python file directly works perfectly fine and packaging with pyinstaller also works, but running the pyinstaller package then throws an Error.
Python Version: 3.7.3
Loguru Version: 0.3.1
Pyinstaller Version: 3.5
OS: Fedora 30
Steps to reproduce:
test.py
with the following contents:pyinstaller test.py
./dist/test/test
I'm then met with the following error:
When I use pyinstaller with the
--hidden-import=distutils
flag, it doesn't work either but just gives me this error instead:I didn't yet come further than this...
Would greatly appreciate any help!
Thank you!
The text was updated successfully, but these errors were encountered: