I'm using PyInstaller to convert .py to .exe.
In the python code, the following command finds the local path of the .py file
path=os.path.dirname(os.path.abspath(__file__))
While running the .exe, the path is diverted to:
...\AppData\Local\Temp\_MEI174042
What is the proper way to find the local path of the .exe file?
You should use this to determine if the application is an exe or not
if getattr(sys, 'frozen', False):
path = os.path.dirname(sys.executable)
elif __file__:
path = os.path.dirname(__file__)