[Pythonmac-SIG] PySide QtCore/QtGui error and Packing python

Srini Kommoori vasure at gmail.com
Thu Dec 2 08:23:31 CET 2010


Hi Guys,

Been juggling and trying to pack a PySide application that I have.
Here is a simple example I am having trouble solving.

1. Install Qt from:
http://get.qt.nokia.com/qt/source/qt-mac-opensource-4.7.1.dmg

2. Install PySide from:
http://kotisivu.dnainternet.net/lamikae/pyside-osx/pyside-1.0.0-beta1-qt47-py26apple.pkg

3. Simple test
#test.py
import sys
from PySide import QtCore, QtGui

import os, uuid

app = QtGui.QApplication(sys.argv)

widget = QtGui.QWidget()
widget.resize(250, 150)
widget.setWindowTitle('test')
widget.show()

sys.exit(app.exec_())

#python test.py - should give a window

4. Try to pack.
#setup.py
from setuptools import setup

APP = ['test.py']
OPTIONS = {'argv_emulation': True,
  'includes': ['PySide.QtCore', 'PySide.QtGui']}

setup(
    app=APP,
    options={'py2app': OPTIONS},
    setup_requires=['py2app'],
)

#python setup.py py2app

5. Try to run the app
open dist/test.app   (or) directly open test.app/Contents/MacOS/test

File "/Users/Srini/Documents/DropAndLock/dist/test.app/Contents/Resources/test.py",
line 2, in <module>
    from PySide import QtCore, QtGui
  File "PySide/__init__.pyc", line 2, in <module>
  File "PySide/private.pyc", line 2, in <module>
  File "PySide/QtCore.pyc", line 18, in <module>
  File "PySide/QtCore.pyc", line 15, in __load
ImportError: '/usr/lib/python2.6/lib-dynload/PySide/QtCore.so' not found
2010-12-01 23:14:08.200 test[22645:903] test Error
2010-12-01 23:14:08.204 test[22645:903] test Error

Not sure how to build this without these problems.

Also, how do I let py2app to pack python in the .app folder itself.
Right now above procedure links python to system python path.

thanks a lot for the help.
-Srini


More information about the Pythonmac-SIG mailing list