Hi people,

I'm attaching an utterly trivial project (the hello world example from
the PyQt tutorial) which shows that py2app-generated *semi-standalone*
apps using Qt fail to run, apparently because of the path to the Qt libs
included in the appdir not being placed in ``sys.path``.

To check this yourselves, simply place ``MyApp.py`` and ``setup.py`` in
the same directory, run ``python setup.py py2app`` and try to open the
resulting app bundle which is left in the ``dist`` directory with Finder.


This is the error dialog that I get::

    MyApp Error

    MyApp Error
    An unexpected error has occurred during execution of the main script

    ImportError: '/Library/Frameworks/Python.framework/Versions/2.5/lib/
    python2.5/lib-dynload/qt.so' not found

And these are the console messages::

    Traceback (most recent call last):
      File "/Users/ivan/MyApp/dist/MyApp.app/Contents/Resources/__boot__.py",
      line 31, in <module>
        _run('MyApp.py')
      File "/Users/ivan/MyApp/dist/MyApp.app/Contents/Resources/__boot__.py",
      line 28, in _run
        execfile(path, globals(), globals())
      File "/Users/ivan/MyApp/dist/MyApp.app/Contents/Resources/MyApp.py",
      line 6, in <module>
        import qt
      File "qt.pyc", line 18, in <module>
      File "qt.pyc", line 15, in __load
    ImportError: '/Library/Frameworks/Python.framework/Versions/2.5/lib/
    python2.5/lib-dynload/qt.so' not found
    2007-07-20 20:11:48.233 MyApp[286] MyApp Error
    2007-07-20 20:11:48.235 MyApp[286] MyApp Error
    An unexpected error has occurred during execution of the main script
    
    ImportError: '/Library/Frameworks/Python.framework/Versions/2.5/lib/
    python2.5/lib-dynload/qt.so' not found


Please note how the app is trying to load ``qt.so`` *from the system*
instead of from the appdir.  Running ``python MyApp.py`` works fine.

I'm using Universal MacPython 2.5, PyQt 3.17 and py2app 0.3.6.

::

        Ivan Vilata i Balaguer   >qo<   http://www.carabos.com/
               Cárabos Coop. V.  V  V   Enjoy Data
                                  ""
#!/usr/bin/env python

# Qt tutorial 1.

import sys
import qt


a = qt.QApplication(sys.argv)

hello = qt.QPushButton("Hello world!", None)
hello.resize(100, 30)

a.setMainWidget(hello)
hello.show()
sys.exit(a.exec_loop())
from distutils.core import setup

import py2app

setup(
    name='MyApp',
    app=['MyApp.py'],
    options=dict(py2app=dict(semi_standalone=True)),
)

Attachment: signature.asc
Description: Digital signature

_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig

Reply via email to