|
View:
New views
10 Messages
—
Rating Filter:
Alert me
|
|
|
py2app cannot move to target thread errorHello, 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@... http://mail.python.org/mailman/listinfo/pythonmac-sig |
|
|
Re: py2app cannot move to target thread errorHello, 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@... > http://mail.python.org/mailman/listinfo/pythonmac-sig _______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@... http://mail.python.org/mailman/listinfo/pythonmac-sig |
|
|
Re: py2app cannot move to target thread errorIf 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@... >> http://mail.python.org/mailman/listinfo/pythonmac-sig > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG@... > http://mail.python.org/mailman/listinfo/pythonmac-sig _______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@... http://mail.python.org/mailman/listinfo/pythonmac-sig |
|
|
Re: py2app cannot move to target thread errorHi all, Has anyone within earshot of this list successfully built a PyQt app with SQL support using py2app? I've been poking and prodding at the problem for a few months now and I'm no closer to a solution to the "cannot move to thread ..." error. Might there be a setup.py solution? Do I need to dig back into my macports installations? How can I locate the source of the offending item? Thanks in advance for any suggestions! I'd be much obliged. Scott On Aug 24, 2009, at 9:49 PM, Scott Frankel wrote: > > 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@... >>> http://mail.python.org/mailman/listinfo/pythonmac-sig >> >> _______________________________________________ >> Pythonmac-SIG maillist - Pythonmac-SIG@... >> http://mail.python.org/mailman/listinfo/pythonmac-sig > _______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@... http://mail.python.org/mailman/listinfo/pythonmac-sig |
|
|
Re: py2app cannot move to target thread error> Has anyone within earshot of this list successfully built a PyQt
> app with SQL support using py2app? I've been poking and prodding > at the problem for a few months now and I'm no closer to a solution > to the "cannot move to thread ..." error. Yes, I think I got this to work recently with Qt3. If I remember correctly, it was due to loading multiple versions of the QtCore library. I think the problem has to do with with Qt plugins not being handled correctly by py2app, and thus the plugins are not being loaded from within in the app bundle. Here's the relevant snippets from the setup.py that I used: name = "program" setup( name = name, ... setup_requires=["py2app"], options = { "py2app": dict( argv_emulation=True, frameworks=[ "/path/to/qt/plugins/sqldrivers/libqsqlpsql.dylib", ], ) }, ... ) if "py2app" in sys.argv: # fix the bundle created by py2app def do(cmd): print " ".join(cmd) subprocess.call(cmd) appdir = os.path.abspath(os.path.join("dist", name + ".app", "Contents")) ... # move the sql driver where Qt will find it plugin_dir = join(appdir, "Resources", "sqldrivers") os.makedirs(plugin_dir) do(["mv", join(appdir, "Frameworks", "libqsqlpsql.dylib"), plugin_dir]) It might be necessary to put the sqldrivers in Contents/MacOS rather than Contents/Resources. I was doing a lot of other strange stuff with this app because I was trying to bundle a bunch of legacy C apps into a stand-alone application that would run on Mac OS. I'm not familiar with using py2app with macports libraries. But it's a red flag to me that your app is loading libraries from /opt/local/... > 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 Shouldn't those libraries be in your app bundle? I would expect to see them loading from somewhere like /path/to/your/program.app/ Contents/MacOS/../Frameworks This leads me to believe that you are in fact loading more than one Qt library, which is causing the "cannot move to thread" error, and is probably due to Qt using the wrong plugin(s). One more thing: I think the plugin resolution logic in Qt changed between Qt3 and Qt4, so the recipe I gave above might not work. You'll need to look that up in the Qt documentation. ~ Daniel _______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@... http://mail.python.org/mailman/listinfo/pythonmac-sig |
|
|
Re: py2app cannot move to target thread errorHi Daniel, Thanks for the info and sample code! I've now got libqsqlpsql.bundle copying to the app bundle's frameworks dir. Reading http://doc.trolltech.com/4.4/deployment-mac.html#linking-the-application-to-qt-as-frameworks , I'm knee deep in otool and install_name_tool. I had no idea I had to wrestle with this for a Python app. I'll post back to the list once I've got things working. At least the train is rolling again! Thanks for your help. Scott On Sep 17, 2009, at 10:55 AM, Daniel Miller wrote: >> Has anyone within earshot of this list successfully built a PyQt >> app with SQL support using py2app? I've been poking and prodding >> at the problem for a few months now and I'm no closer to a solution >> to the "cannot move to thread ..." error. > > Yes, I think I got this to work recently with Qt3. If I remember > correctly, it was due to loading multiple versions of the QtCore > library. I think the problem has to do with with Qt plugins not > being handled correctly by py2app, and thus the plugins are not > being loaded from within in the app bundle. Here's the relevant > snippets from the setup.py that I used: > > name = "program" > > setup( > name = name, > ... > setup_requires=["py2app"], > options = { > "py2app": dict( > argv_emulation=True, > frameworks=[ > "/path/to/qt/plugins/sqldrivers/libqsqlpsql.dylib", > ], > ) > }, > ... > ) > > if "py2app" in sys.argv: > # fix the bundle created by py2app > def do(cmd): > print " ".join(cmd) > subprocess.call(cmd) > appdir = os.path.abspath(os.path.join("dist", name + ".app", > "Contents")) > > ... > > # move the sql driver where Qt will find it > plugin_dir = join(appdir, "Resources", "sqldrivers") > os.makedirs(plugin_dir) > do(["mv", join(appdir, "Frameworks", "libqsqlpsql.dylib"), > plugin_dir]) > > > It might be necessary to put the sqldrivers in Contents/MacOS rather > than Contents/Resources. I was doing a lot of other strange stuff > with this app because I was trying to bundle a bunch of legacy C > apps into a stand-alone application that would run on Mac OS. > > I'm not familiar with using py2app with macports libraries. But it's > a red flag to me that your app is loading libraries from /opt/ > local/... > >> 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 > > Shouldn't those libraries be in your app bundle? I would expect to > see them loading from somewhere like /path/to/your/program.app/ > Contents/MacOS/../Frameworks > > This leads me to believe that you are in fact loading more than one > Qt library, which is causing the "cannot move to thread" error, and > is probably due to Qt using the wrong plugin(s). > > One more thing: I think the plugin resolution logic in Qt changed > between Qt3 and Qt4, so the recipe I gave above might not work. > You'll need to look that up in the Qt documentation. > > ~ Daniel > > > _______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@... http://mail.python.org/mailman/listinfo/pythonmac-sig |
|
|
Re: py2app cannot move to target thread errorScott Frankel wrote:
> Thanks for the info and sample code! I've now got libqsqlpsql.bundle > copying to the app bundle's frameworks dir. > > Reading > http://doc.trolltech.com/4.4/deployment-mac.html#linking-the-application-to-qt-as-frameworks, > I'm knee deep in otool and install_name_tool. I had no idea I had to > wrestle with this for a Python app. > > I'll post back to the list once I've got things working. Ideally, when you've got it figured out, it could be turned into a py2app recipe and contributed to trunk -- hint, hint! -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker@... _______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@... http://mail.python.org/mailman/listinfo/pythonmac-sig |
|
|
Re: py2app cannot move to target thread errorI've just now gotten my app to launch without error. qt.conf was the key. Thanks to Daniel and Marc-Antoine for their posts! Interestingly, manipulating library names and paths with install_name_tool was not necessary in my case. Not sure why not. Creating a plugins/sqldrivers dir, copying the libqsqlpsql.bundle to it, then creating a qt.conf INI file specifying that location within the app bundle was all that was needed. I'll be happy to contribute my final setup.py file as a recipe. How would I go about that? Meanwhile, here are a couple of URLs that provided useful information: http://doc.trolltech.com/4.4/deployment-mac.html#linking-the-application-to-qt-as-frameworks http://doc.trolltech.com/4.4/qt-conf.html Thanks Scott On Sep 18, 2009, at 9:31 AM, Christopher Barker wrote: > Scott Frankel wrote: >> Thanks for the info and sample code! I've now got >> libqsqlpsql.bundle copying to the app bundle's frameworks dir. >> Reading http://doc.trolltech.com/4.4/deployment-mac.html#linking-the-application-to-qt-as-frameworks >> , I'm knee deep in otool and install_name_tool. I had no idea I >> had to wrestle with this for a Python app. >> I'll post back to the list once I've got things working. > > Ideally, when you've got it figured out, it could be turned into a > py2app recipe and contributed to trunk -- hint, hint! > > -Chris > > > > -- > Christopher Barker, Ph.D. > Oceanographer > > Emergency Response Division > NOAA/NOS/OR&R (206) 526-6959 voice > 7600 Sand Point Way NE (206) 526-6329 fax > Seattle, WA 98115 (206) 526-6317 main reception > > Chris.Barker@... > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG@... > http://mail.python.org/mailman/listinfo/pythonmac-sig _______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@... http://mail.python.org/mailman/listinfo/pythonmac-sig |
|
|
Re: py2app cannot move to target thread errorScott Frankel wrote:
> Creating a plugins/sqldrivers dir, copying the libqsqlpsql.bundle to it, > then creating a qt.conf INI file specifying that location within the app > bundle was all that was needed. > > I'll be happy to contribute my final setup.py file as a recipe. How > would I go about that? If nothing else, please post it here for the archives. There must be a Wiki you could post it to, but I'm not sure which is best. However, when I wrote: >> Ideally, when you've got it figured out, it could be turned into a >> py2app recipe and contributed to trunk -- hint, hint! I was referring to the "recipes" that come bundles with py2app, and are automatically invoked when a given package is used. You can find the existing ones in the py2app package: py2app/recipes Note that there is one there called "sip.py" which is used when building an app that used sip-based bindings --i.e. qt. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker@... _______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@... http://mail.python.org/mailman/listinfo/pythonmac-sig |
|
|
Re: py2app cannot move to target thread errorHi all, In my last post I mentioned that the qt.conf INI file was key to fixing the "cannot move to target thread" problem, caused by multiple instances of Qt running in the same app. The following setup.py file is my encapsulation of the solution. This is my first brush with py2app, so there may well be some idiosyncrasies in my code. I'll look into contributing a recipe when more of the dust settles. Thanks Scott #------------------------------------------------------------------------------- # This is a py2app setup.py file, created to build a Qt4 PyQt application # that relies on the PQSQL plugin. Note that the app links to Qt as Frameworks # and references filenames and directories as installed via macports. #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- # imports #------------------------------------------------------------------------------- import sys, os import subprocess from setuptools import setup #------------------------------------------------------------------------------- # names and dirs #------------------------------------------------------------------------------- name = 'Appname' APP = ['Appname.py'] appdir = os.path.abspath(os.path.join("dist", name + ".app", "Contents")) #------------------------------------------------------------------------------- # options - setup #------------------------------------------------------------------------------- OPTIONS = {'argv_emulation': True, 'includes': ['sip', 'PyQt4._qt'], 'excludes': ['PyQt4.QtDesigner', 'PyQt4.QtNetwork', 'PyQt4.QtOpenGL', 'PyQt4.QtScript', 'PyQt4.QtTest', 'PyQt4.QtWebKit', 'PyQt4.QtXml', 'PyQt4.phonon'], # qt4-mac plugins dir from macports install 'frameworks': ["/opt/local/libexec/qt4-mac/plugins/sqldrivers/ libqsqlpsql.bundle"], } setup( app=APP, options={'py2app': OPTIONS}, setup_requires=['py2app'], ) #------------------------------------------------------------------------------- # methods #------------------------------------------------------------------------------- # wrap subprocess def doSubproc(cmd): print " ".join(cmd) subprocess.call(cmd) #------------------------------------------------------------------------------- # plugin location #------------------------------------------------------------------------------- # copy plugin to the app bundle's plugins dir. According to Qt docs: # application.app/Contents/plugins/ is the default location for loading Qt plugins if "py2app" in sys.argv: # libqsqlpsql belongs in plugins/sqldrivers plugin_dir = os.path.join(appdir, "plugins", "sqldrivers") os.makedirs(plugin_dir) doSubproc(["cp", os.path.join(appdir, "Frameworks", "libqsqlpsql.bundle"), plugin_dir]) #------------------------------------------------------------------------------- # qt.conf INI file #------------------------------------------------------------------------------- # create qt.conf INI file. For more info, # http://doc.trolltech.com/4.4/qt-conf.html iniFilename = os.path.join(appdir, "Resources", "qt.conf") iniFile = open(iniFilename, 'w') try: print "writing %s" % iniFilename iniFile.write("[Paths]\nqt_plugpath=plugins") except IOError: print "ERROR: %s not written" % iniFilename iniFile.close() # for more info on building Qt apps on Mac OSX, including static linking, # linking to Qt as Frameworks, otool, install_name_tool, and dependencies: # http://doc.trolltech.com/4.4/deployment-mac.html#linking-the-application-to-qt-as-frameworks _______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@... http://mail.python.org/mailman/listinfo/pythonmac-sig |
| Free embeddable forum powered by Nabble | Forum Help |