-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exception in PyInstaller packaged app #16
Comments
Hey @z4none! Thank you for reaching out! We have seen this issue happen when your System drive is C:/ while your Python is on D:/.
Let me know if this solves the issue. 🙏 Thanks again for raising this. |
I have tested the code above, but it failed with an exception.
I created a minimal script to reproduce the exception in # main.py
import logging
from logtail import LogtailHandler
handler = LogtailHandler(source_token='my token', raise_exceptions=True)
logger = logging.getLogger(__name__)
logger.addHandler(handler)
logger.setLevel(logging.INFO)
logger.info(f"Hello") If i run
My current solution is to modify def _relative_to_main_module_if_possible(pathname):
has_main_module = hasattr(__main__, '__file__')
try:
return _relative_to_main_module(pathname) if has_main_module else pathname
except:
return pathname |
I am using logtail in a PyInstaller packaged project on Windows, my exe is saved on drive D:
I create the LogtailHandler with
raise_exceptions=True
, when I calllogger.info
I got these exception:It appears that the exe was launched from another drive than the one py file was unpacked from, so that logtail cant get the relative path.
versions
windows: 10
python: 3.9
logtail-python: 0.2.6
pyinstaller: 5.13.0
The text was updated successfully, but these errors were encountered: