[PyKDE] Re: embedding python widgets in C++ app

Miguel Lobo mlobol at gmail.com
Sat Jan 27 10:33:32 GMT 2007


> > ok, removing all instances of "PyQt4." from the cpp, and without
> > modifying the sip files, I get this error for
> > PyRun_SimpleString("import QtCore; print QtCore"):
> >
> > SystemError: _PyImport_FixupExtension: module QtCore not loaded
> >
> > and this error for PyRun_SimpleString("import QtGui; print QtGui"):
> >
> > ImportError: No module named PyQt4.QtCore
> >
> > After changing the module names in the sip files and recompiling the
> > PyQt4 static libs it seems to work. I That means that the PyQt4
> > package definately gets in the way.
> >
> > So this looks fine except everyone on our team has to do this
> > everytime they download a new version. Ideas?
>
> So if I added a command line flag to SIP to ignore all but the last part of
> a %Module directive, and tied that flag to the -k flag of PyQt's
> configure.py, then it should work Ok?

I run into the exact same problem as Patrick a couple of days ago.  I have 
submitted a patch to the Python team that allows "import PyQt4.QtCore" to 
work.  You can find the patch here: 
http://sourceforge.net/tracker/?func=detail&aid=1644818&group_id=5470&atid=305470

I would vote against renaming PyQt4.QtCore to QtCore for the statically linked 
PyQt because then it would mean that you need "from PyQt4 import QtCore" if 
you have linked PyQt4 dynamically and "import QtCore" if you have linked it 
statically.  I use static PyQt4 in Windows (for ease of deployment), but in 
Linux I use the dynamic version, so this solution would be inconvenient for 
me.

--
Miguel




More information about the PyQt mailing list