[PyQt] cannot move to target thread

Scott Frankel frankel at circlesfx.com
Tue Aug 25 16:53:18 BST 2009


Hello,

Pardon the cross-post and tangential subject matter.  My PyQt-QPSQL  
app dies on OSX, yielding the following error:  "Cannot move to target  
thread."  Linux and Windows builds behave properly.  I've rebuilt my  
macports environment from scratch, googled myself silly, and poked and  
prodded my environment for several weeks.  If someone here has any  
insight to offer on how I can rectify the problem, I'd be grateful.

I've traced the problem to a py2app options include of PyQt4.QtSql.   
My app requires QPSQL, though tests with QSQLITE also yield the same  
error.

Setting the DYLD_PRINT_LIBRARIES env var, yields the following output  
on app launch:

...
Qt Version:    4.5.2
PyQt Version:  4.5.4
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 (0x1da760) is not the object's  
thread (0x1b1b10).
Cannot move to target thread (0x1b1b10)

On Mac OS X, you might be loading two sets of Qt binaries into the  
same process. Check that all plugins are compiled against the right Qt  
binaries. Export DYLD_PRINT_LIBRARIES=1 and check that only one set of  
binaries are being loaded.
...



My macports environment looks like this:

...
  postgresql83 @8.3.1_0 (active)
...
  py26-altgraph @0.6.7_0 (active)
  py26-bdist_mpkg @0.4.4_0 (active)
  py26-macholib @1.2_0 (active)
  py26-modulegraph-devel @0.7.2_0 (active)
  py26-py2app-devel @0.4.2_1 (active)
  py26-pyqt4 @4.5.4_0 (active)
  py26-setuptools @0.6c9_0 (active)
  py26-sip @4.8.2_0 (active)
...
  qt4-mac @4.5.2_1+psql (active)
...


Any thoughts or suggestions?

Thanks!
Scott


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20090825/986c0844/attachment.html


More information about the PyQt mailing list