Reputation: 137
Recently I've been working on a Python project that requires human interaction with other files. I compiled it to one file. I tried to get the absolute path to that compiled file. However, everything the internet has suggested leads me to the _Meixxxx temp folder. Although useful, it's not very well situated for human interaction. Is there any way that I can find the absolute path to my exe file and not the _Meixxxx folder?
I've tried several things including:
os.cwdir
os.path.dirname
Thank you for any help in advance
EDIT:
Thanks to @johnashu
os.path.dirname(os.path.realpath(__file__))
This seems to correctly find the path of the file location
Upvotes: 1
Views: 136
Reputation: 137
As @johnashu suggested
os.path.dirname(os.path.realpath(__file__))
should give you the actual location for your exe file
Upvotes: 1