pyinstaller read file from launched directory code example
Example: pyinstaller onefile current working directory
import os, sys
# determine if the application is a frozen `.exe` (e.g. pyinstaller --onefile)
if getattr(sys, 'frozen', False):
application_path = os.path.dirname(sys.executable)
# or a script file (e.g. `.py` / `.pyw`)
elif __file__:
application_path = os.path.dirname(__file__)
config_name = 'myConfig.cfg'
config_path = os.path.join(application_path, config_name)