py2app cannot move to target thread error

Scott Frankel leknarf at pacbell.net
Mon Aug 10 14:59:40 PDT 2009


Hello,

I'm troubleshooting a PyQt-PostgreSQL py2app error:  "Cannot move to  
target thread".  From the research I've done so far, I believe that  
the problem is due to an error in the way I've created my build  
environment.

I used macports to create a build environment for my Python-PyQt- 
PostgreSQL app.  I've used my environment to build simple apps that  
run happily.  I'm now trying to build an app that leverages PostgreSQL  
and the app fails on launch with a Qt error:  "Cannot move to target  
thread".  Adding PyQt4.QtSql to py2app's option includes either causes  
or reveals the problem.  eg:

This works:
	OPTIONS = {'argv_emulation': True, 'includes': ['sip', 'PyQt4._qt']}

This doesn't:
	OPTIONS = {'argv_emulation': True, 'includes': ['sip', 'PyQt4._qt',  
'PyQt4.QtSql']}

Researching the error, I've set DYLD_PRINT_LIBRARIES=1 in my shell and  
am looking for duplicate instances of Qt libraries.  I'm not seeing  
anything obvious.  But I also don't know exactly what to look for.

For example, should I be concerned with dyld output running the app or  
building it?  The last of the dyld output looks like this:

dyld: loaded: /opt/local/libexec/qt4-mac/plugins/sqldrivers/ 
libqsqlpsql.bundle
dyld: loaded: /opt/local/lib/postgresql83/libpq.5.dylib
dyld: loaded: /opt/local/libexec/qt4-mac/lib/QtSql.framework/Versions/ 
4/QtSql
dyld: loaded: /opt/local/libexec/qt4-mac/lib/QtCore.framework/Versions/ 
4/QtCore
dyld: loaded: /opt/local/lib/libz.1.dylib
dyld: loaded: /opt/local/lib/libssl.0.9.8.dylib
dyld: loaded: /opt/local/lib/libcrypto.0.9.8.dylib
QObject::moveToThread: Current thread (0x1d17d0) is not the object's  
thread (0x1a7820).
Cannot move to target thread (0x1a7820)


Suggestions?

Thanks in advance!
Scott



More information about the macports-users mailing list