Quantcast
Channel: Is there a way to specify the actual location of a file compiled with Pyinstaller (--onefile) and not the temporary _Meixxxx folder - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Is there a way to specify the actual location of a file compiled with Pyinstaller (--onefile) and not the temporary _Meixxxx folder

$
0
0

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.cwdiros.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


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>
<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596344.js" async> </script>