【发布时间】:2012-03-18 23:53:05
【问题描述】:
这类似于Where to put a configuration file in Python?,但我询问的是在 Windows 系统上使用 py2exe 或类似工具编译/冻结的脚本。 (即这个:What config file format to use for user-friendly strings of arbitrary bytes?https://gist.github.com/1119561)
我的第一个想法是将配置文件与 .exe 放在同一个文件夹中,这使它有点独立。但是如果我将文件与 .exe 相关联,它将从它们的目录中调用,而不是从它自己的目录中调用,所以我需要像 How do I get the path of the current executed file in Python? 这样的东西来查找配置文件。
这是最好的方法吗?或者是否有一些标准配置文件位置可供搜索,例如https://stackoverflow.com/a/7567946/125507?
【问题讨论】:
标签: python configuration-files py2exe cx-freeze