On Tue, 3 Mar 2009 16:20:34 -1000, McKay Davis <mckay....@gmail.com> wrote: > 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?
>From memory (so take with a pinch of salt) Python doesn't handle builtin packages (as opposed to modules) without a patch. I don't know if that patch has made it to current versions of Python. Check the archives of this mailing list. Phil _______________________________________________ PyQt mailing list PyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt