PyQt4 import failure

Previous topic - Next topic

mielot

Hi

I'm trying to import PyQt4 - but get a 'no module named' error.
I can vouch that PyQt4 is definitely installed though.

Any ideas?

Kindest regards

J

Astroman Pete

This thread is a bit stale, but a reply might help others.

I'm developing at work on a Windows machine where compiling Scribus and it's dependencies is impractical.
You must have Python bindings that reference the same version of Qt that Scribus is compiled against. You can find the Qt version under "Help > About Qt" in the pull-down menus.
What worked for me, was to then install the PySide bindings with the same Qt version number from http://www.pyside.org/files/.

Your QT bindings then need to be on your Python path. For me I had to:

import sys
sys.path.append('C:\Python27\Lib\site-packages')
from PySide import QtCore, QtGui


You must run your script as an extension script, also, or Scribus will freeze at this point.

My reasoning for using PySide and not PyQt4 are:
1. More permissive licensing.
2. I couldn't find older binaries for PyQt4. On non-Windows platforms, it may be more practical to compile Scribus against the version of Qt your PyQt4 uses.

a.l.e

getting pyqt to work with the (older) scripter (in 1.4) is not trivial. but possible.

it will be much easier with 1.6 (and the new scripter)