Scribus Forums

Scribus => Scripts and Plugins => Topic started by: mielot on March 05, 2012, 12:37:55 PM

Title: PyQt4 import failure
Post by: mielot on March 05, 2012, 12:37:55 PM
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
Title: Re: PyQt4 import failure
Post by: Astroman Pete on June 18, 2012, 08:46:54 PM
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/ (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.
Title: Re: PyQt4 import failure
Post by: a.l.e on June 19, 2012, 07:56:50 PM
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)