[Pythonmac-SIG] py2app cannot move to target thread error

Scott Frankel leknarf at pacbell.net
Tue Aug 25 06:49:22 CEST 2009


If someone has any wisdom to share regarding building a PyQt app with  
SQL support, I'd be grateful.


I've deleted and rebuilt my macports environment from scratch and  
googled myself silly.  In a classic snake-eating-tail moment, my  
online searches are returning my own posts more often than not.

My test apps that call for either QPSQL or QSQLITE die, while my test  
app that does not include PyQt4.QtSql continues to build and run  
happily.  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






On Aug 19, 2009, at 10:41 AM, Scott Frankel wrote:

>
> Hello,
>
> I'm stuck somewhere between macports and py2app.  I'm hopeful that  
> someone here may be able to offer some advice on how to rectify my  
> build environment.
>
> Exporting DYLD_PRINT_LIBRARIES=1 and running a test app built with  
> QtSql support and another one without it, I'm pretty sure that the  
> following line is the clue:
>
> 	dyld: loaded: /opt/local/libexec/qt4-mac/plugins/sqldrivers/ 
> libqsqlpsql.bundle
>
> My question is, how do I access/get/compile the PSQL support my app  
> requires?  My environment's qt4-mac, python26, and py2app are from  
> macports.  The qt4-mac has the psql dependency:
>
> 	py26-py2app-devel @0.4.2_1 (active)
> 	py26-pyqt4 @4.5.4_0 (active)
> 	qt4-mac @4.5.1_0+psql (active)
> 	
> Thanks in advance!
> Scott
>
>
>
>
>
> On Aug 10, 2009, at 8:51 AM, Scott Frankel wrote:
>
>>
>> Hello,
>>
>> I'm troubleshooting a PyQt-PostgreSQL py2app error:  "Cannot move  
>> to target thread".  Note that a test app builds and runs happily.   
>> The error only comes up when I add PyQt4.QtSql' to py2app's option  
>> includes.  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?
>>
>> I created my build environment using macports.  It looks like the  
>> correct libs are being accessed.  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
>>
>>
>>
>>
>>
>> _______________________________________________
>> Pythonmac-SIG maillist  -  Pythonmac-SIG at python.org
>> http://mail.python.org/mailman/listinfo/pythonmac-sig
>
> _______________________________________________
> Pythonmac-SIG maillist  -  Pythonmac-SIG at python.org
> http://mail.python.org/mailman/listinfo/pythonmac-sig



More information about the Pythonmac-SIG mailing list