I am having problems building my PySide Python app using py2app (for OS X). It appears that something funny happens with threads on the app bundle.
Here is the minimal example
from PySide.QtCore import *
from PySide.QtGui import *
import sys
class App(QApplication):
def __init__(self):
QApplication.__init__(self, sys.argv, True)
self.timer = QTimer(self)
if __name__=='__main__':
app = App()
app.exec_()
When run from the command line: python test.py
, this works fine without error. However when I then compile it with the following setup.py:
from setuptools import setup
import py2app
import PySide
APP = ['test.py']
DATA_FILES = []
OPTIONS = {'argv_emulation': False,
'includes' : 'PySide',
'resources' : "qt_menu.nib"
}
setup(
app=APP,
data_files=DATA_FILES,
options={'py2app': OPTIONS},
setup_requires=['py2app'],
)
these errors appear in the Console:
11/05/2013 13:54:20.958 [0x0-0xb37b37].org.pythonmac.unspecified.test: QObject: Cannot create children for a parent that is in a different thread.
11/05/2013 13:54:20.958 [0x0-0xb37b37].org.pythonmac.unspecified.test: (Parent is App(0x105f41f10), parent's thread is QThread(0x100106cc0), current thread is QThread(0x10251ea80)
So it appears that App is not being constructed to live in the main thread any more. Any ideas how to fix this?