[PyQt] Static PyQt Initialization

McKay Davis mckay.cpp at gmail.com
Wed Mar 4 02:20:34 GMT 2009


Hi all,

My setup: Windows 32-bit, Visual Studio 2008, PyQt 4.4.4, Qt 4.4.3, sip
4.7.9.

I need to build SIP, Python and PyQt statically.  I can get everything to
build and link but I cannot figure out how to correctly initialize PyQt so
that Python finds it as a builtin module.

This message:

http://thread.gmane.org/gmane.comp.python.pyqt-pykde/14422/focus=14425

covers what I need except for the exact syntax of the call to
PyImport_ExtendInittab()

I duplicated what this poster tried (w/ the same results):

http://lists.kde.org/?l=pykde&m=116959724322512&w=2

I added the following code to my python interpreter executable:

extern void initsip(void);
extern void initQtCore(void);
extern void initQtGui(void);
struct _inittab pyqt_inittab[] = {
  {"sip", initsip}
  {"PyQt4.QtCore", initQtCore},
  {"PyQt4.QtGui", initQtGui}
  {0, 0}
};
int main(int argc, char **argv)
{
  PyImport_ExtendInittab(pyqt_inittab);
  Py_Initialize();
...

The python interpeter executable builds and links, but running the
PyQt/examples/tutorial/t1.pyw example script returns the error:

Traceback (most recent call last):
  File "t1.pyw", line 7, in <module>
    from PyQt4 import QtGui
ImportError: cannot import name QtGui
[13350 refs]

Can anybody please provide me the correct inittab entries for a static PyQt?

Thanks,

-McKay Davis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20090304/200dd1b3/attachment.html


More information about the PyQt mailing list