Missing exception log data when using pyinstaller
See original GitHub issueI’m using loguru in one of my projects while using pyinstaller to create an EXE to run it on several Windows machines. I noticed some log data missing from exceptions when running the EXE. Here is an example of what I’m seeing.
# test.py
from loguru import logger
logger.add('test.log')
def div(n, d):
try:
return n / d
except Exception as e:
logger.exception(e)
div(2, 0)
When running this from the terminal it will produce this log file as expected.
2020-04-20 12:46:32.123 | ERROR | __main__:div:9 - division by zero
Traceback (most recent call last):
File "test.py", line 11, in <module>
div(2, 0)
└ <function div at 0x7f81f5ee43b0>
> File "test.py", line 7, in div
return n / d
│ └ 0
└ 2
ZeroDivisionError: division by zero
But once you use pyinstaller (pyinstaller test.py -F
) and run the resulting EXE this is what is in the log file.
2020-04-20 12:45:19.427 | ERROR | __main__:div:9 - division by zero
Traceback (most recent call last):
File "test.py", line 11, in <module>
> File "test.py", line 7, in div
ZeroDivisionError: division by zero
I have been able to reproduce this with python 3.8 on Windows 10 and python 3.7 on Fedora 30 using loguru==0.4.1 & PyInstaller==3.6
Not sure if this is an pyinstaller issue or a loguru issue, trying here first.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top Results From Across the Web
When Things Go Wrong — PyInstaller 5.7.0 documentation
PyInstaller sometimes terminates by raising a Python exception. In most cases the reason is clear from the exception message, for example “Your system...
Read more >Missing dll files when using pyinstaller - python - Stack Overflow
Show activity on this post. I'm using Windows 10 and had to delete the data in the C:\Users<username>\AppData\Local\pyinstaller directory and ...
Read more >got error after compiled my python script with pyinstaller #929
I tried strace -e trace=stat and I just got a huge log telling me lots of files are missing...
Read more >Using PyInstaller to Easily Distribute Python Applications
In this step-by-step tutorial, you'll learn how to use PyInstaller to turn your ... Often, you'll see ImportError exceptions if a dependency is...
Read more >Packaging PyQt5 applications for Windows, with PyInstaller ...
Window with icon missing. The icons don't appear. What's happening? We're using relative paths to refer to our data files. These paths are ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
https://github.com/pyinstaller/pyinstaller/issues/4826#issuecomment-617728206 This worked for me. Thanks again for the help @Delgan
https://github.com/pyinstaller/pyinstaller/issues/4826