setup.py
APP = ['systray.py']
DATA_FILES = []
OPTIONS = {'argv_emulation': True,
'includes': ['djmemori.settings'],
'packages': ['django', 'south'],
'qt_plugins': 'imageformats' # if I comment out this line, python setup.py py2app will success
}
setup(
app=APP,
data_files=DATA_FILES,
options={'py2app': OPTIONS},
setup_requires=['py2app'],
)
python setup.py py2app
...
copying file /Users/teamx/workspace/env-memori-pkg/lib/python2.7/site-packages/py2app/recipes/qt.conf -> /Users/teamx/workspace/memori_pc/src/djmemori/dist/systray.app/Contents/Resources/qt.conf
copying file /Developer/Applications/Qt/plugins/imageformats/libqgif.dylib -> /Users/teamx/workspace/memori_pc/src/djmemori/dist/systray.app/Contents/Resources/qt_plugins/imageformats/libqgif.dylib
copying file /Developer/Applications/Qt/plugins/imageformats/libqico.dylib -> /Users/teamx/workspace/memori_pc/src/djmemori/dist/systray.app/Contents/Resources/qt_plugins/imageformats/libqico.dylib
copying file /Developer/Applications/Qt/plugins/imageformats/libqjpeg.dylib -> /Users/teamx/workspace/memori_pc/src/djmemori/dist/systray.app/Contents/Resources/qt_plugins/imageformats/libqjpeg.dylib
copying file /Developer/Applications/Qt/plugins/imageformats/libqmng.dylib -> /Users/teamx/workspace/memori_pc/src/djmemori/dist/systray.app/Contents/Resources/qt_plugins/imageformats/libqmng.dylib
copying file /Developer/Applications/Qt/plugins/imageformats/libqsvg.dylib -> /Users/teamx/workspace/memori_pc/src/djmemori/dist/systray.app/Contents/Resources/qt_plugins/imageformats/libqsvg.dylib
copying file /Developer/Applications/Qt/plugins/imageformats/libqtiff.dylib -> /Users/teamx/workspace/memori_pc/src/djmemori/dist/systray.app/Contents/Resources/qt_plugins/imageformats/libqtiff.dylib
copying file /.dbfseventsd -> /Users/teamx/workspace/memori_pc/src/djmemori/dist/systray.app/Contents/Resources/qt_plugins/imageformats/.dbfseventsd
error: /.dbfseventsd: Operation not supported on socket
答案 0 :(得分:1)
更改代码py2app / recipes / pyside.py:21
if '*' in item:
for path in glob.glob(os.path.join(plugin_dir, item)):
resources.append((os.path.dirname('qt_plugins' + path[len(plugin_dir):]), [path]))
else:
resources.append((os.path.dirname(os.path.join('qt_plugins', item)), os.path.join(plugin_dir, item)))
到
if '*' in item:
for path in glob.glob(os.path.join(plugin_dir, item)):
resources.append((os.path.dirname('qt_plugins' + path[len(plugin_dir):]), [path]))
else:
resources.append((os.path.dirname(os.path.join('qt_plugins', item)), os.path.join(plugin_dir, item)))
可以解决此问题。
代码缩进问题会导致py2app添加资源:
('qt_plugins / imageformats',u'/ Developer / Applications / Qt / plugins / imageformats / *')#注意元组的第二项应该是一个列表,但这里是一个字符串
然后在py2app / build_app.py:598
def iter_data_files(self):
dist = self.distribution
allres = chain(getattr(dist, 'data_files', ()) or (), self.resources)
for (path, files) in (normalize_data_file(fn) for fn in allres):
path = fsencoding(path)
for fn in files: # <-- this line
fn = fsencoding(fn)
yield fn, os.path.join(path, os.path.basename(fn))
文件应该是一个列表,但现在,它是一个字符串:u'/ Developer / Applications / Qt / plugins / imageformats / *' 这将导致py2app复制路径中的文件:'/','D','e','v',... 所以py2app开始迭代根路径'/',当它包含/.dbfseventsd时,它崩溃了。
答案 1 :(得分:0)
这看起来像是py2app中的一个错误。如果在“/ Developer / Applications / Qt / plugins / imageformats”(或指向该文件的符号链接)中有一个名为“.dbfseventsd”的文件,你能检查一下吗?
另外,请在https://bitbucket.org/ronaldoussoren/py2app提交问题,以确保我不会忘记实际解决问题。