# determine if application is a script file or frozen exe
if getattr(sys, 'frozen', False):
application_path = os.path.dirname(sys.executable)
elif __file__:
application_path = os.path.dirname(__file__)
from:--
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 visit https://groups.google.com/d/msgid/pyinstaller/84bc6f62-3d54-4aef-b6ee-ca8f667f2113n%40googlegroups.com.
though that Stackoverflow article got s bit confusing when you read down it a bit
Ughh, that’s mostly because every answer on there is wrong. (At least now I know why those snippets keep appearing on the issue tracker.)
Note that you’re specifically looking for the executable path whereas that Stackoverflow question is asking about application resources so sys.executable is right for your use case but wrong for what that question is about.
Actually, on rereading, it looks like the question was specifically asking the external files next to the application question. It’s just that most of the answers were for the wrong question.