将Python包转换并运行为.egg文件

时间:2015-10-23 10:56:42

标签: python setup.py egg

我尝试将langdetect包转换为.egg文件。但是,在python代码中导入和使用.egg文件时,我收到以下错误消息:

IOError: [Errno 20] Not a directory: '/workspace/langdetect-1.0.1/dist/langdetect-1.0.1-py2.7.egg/langdetect/utils/messages.properties'

在深入研究库代码后,我发现它尝试将messages.properties文件加载为:

MESSAGES_FILENAME = path.join(path.dirname(__file__), 'messages.properties')
with open(self.MESSAGES_FILENAME, 'r') as f:

当库被压缩为.egg文件时显然不起作用,因为messages.properties的新路径是:

/workspace/langdetect-1.0.1/dist/langdetect-1.0.1-py2.7.egg/langdetect/utils/messages.properties

如何更改上述代码,以便从.egg文件中加载messages.properties

0 个答案:

没有答案