📅  最后修改于: 2022-03-11 14:45:34.545000             🧑  作者: Mango
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)