Author Topic: PyQt4 import failure  (Read 1902 times)

mielot

  • Newbie
  • *
  • Posts: 1
  • Karma: 0
  • Scribus User
PyQt4 import failure
« on: March 05, 2012, 01: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

Astroman Pete

  • Newbie
  • *
  • Posts: 15
  • Karma: 0
  • Scribus User
Re: PyQt4 import failure
« Reply #1 on: June 18, 2012, 09: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/.

Your QT bindings then need to be on your Python path. For me I had to:
Code: [Select]
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

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1441
  • Karma: 19
    • the graphics lab
Re: PyQt4 import failure
« Reply #2 on: June 19, 2012, 08: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)

 

palmate