Size: 1915
Comment:
|
Size: 2420
Comment: PyQt and Phonon
|
Deletions are marked like this. | Additions are marked like this. |
Line 56: | Line 56: |
== PyQt4 and Phonon == In a similar manner as using PyQt4 and SQlite (from pyqt), one need to add an extra step to use Phonon. The very first setup.py is needed, with includes for sip. But one have to also copy the phonon_backend directory from PyQt4 installation to your dist directory Otherwise you get an error: "phonon backend could not be loaded" '''I think this could be generalize to any directory in your PyQt4\plugins directory that you might need, depending on what you use in PyQt.''' |
Error message
File "form1.pyc", line 11, in ? File "qt.pyc", line 9, in ? File "qt.pyc", line 7, in __load ImportError: No module named sip
Solution
python setup.py py2exe --includes sip
setup.py
Reference
I found this tips here : http://nerdierthanthou.nfshost.com/2005/03/image-resizer.html
There is a full code sample.
Another Solution to the same problem:
from distutils.core import setup import py2exe setup(windows=[{"script":"main.py"}], options={"py2exe":{"includes":["sip"]}})
I found that on the web, unfortunately don't know anymore where, but it also works for me!
Obviously is the second part only a way to get the " --includes sip" parameter directly into the script, but the use of "windows" instead of "console" doesn't open a console window, but immediately a Qt window in my case.
Fix for PyQt4
If you get the following error:
ImportError: No module named _qt
The solution is to add PyQt4._qt to the setup function (see bellow). I found the solution for the problem here.
Using PyQt4 with Databases
When deploying applications which use PyQt4 and SQLite:
Copy the contents of PyQt4\plugins\sqldrivers to <appdir>\sqldrivers. It did not work for me in any subdirectory including the zipfile directory. For SQLite I only needed to copy qsqlite4.dll.
- A separate copy of sqlite3.dll is not needed.
PyQt4 and Phonon
In a similar manner as using PyQt4 and SQlite (from pyqt), one need to add an extra step to use Phonon. The very first setup.py is needed, with includes for sip. But one have to also copy the phonon_backend directory from PyQt4 installation to your dist directory Otherwise you get an error: "phonon backend could not be loaded"
I think this could be generalize to any directory in your PyQt4\plugins directory that you might need, depending on what you use in PyQt.