--
You received this message because you are subscribed to the Google Groups "PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyinstaller...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyinstaller/492b21e0-c627-43c1-8fa8-3fa43521aa00n%40googlegroups.com.
Ughh, I’ve seen that snippet of misinformation before on stackoverflow. The code in the else block is what you should be running unconditionally. If that can’t find your resources then you’re putting your data files in the wrong place inside your application and you should adjust the DEST part of your --add-data flags until it does work. There is also a sys._MEIPASS variable that also gives you the application’s path but again, I try to steer people away from that because 99% of the time they’d be better off using __file__.
That code snippet works in PyInstaller <6 (well no, it breaks under onefile mode, but under onedir mode it worked) because os.path.dirname(sys.executable) used to, by happenstance rather than design, equal sys._MEIPASS. PyInstaller 6.0 moved most of the application into this new _internal directory though so now those two are no longer equal.
Ughh, I’ve seen that snippet of misinformation before on stackoverflow.