[PyQt] Python 3 import error

Thorsten Kampe thorsten at thorstenkampe.de
Thu Dec 2 11:47:33 GMT 2010


* Phil Thompson (Thu, 02 Dec 2010 11:31:13 +0000)
> On Thu, 2 Dec 2010 12:24:54 +0100, Thorsten Kampe
> <thorsten at thorstenkampe.de> wrote:
> > I'm trying to port a PyQt4 application from Python 2 to Python 3. 
The 
> > application works fine with the latest Python 2 (2.7.1) but not with 
> > Python 3.1.2:
> > 
> > Traceback (most recent call last):
> >   File "my_application.pyw", line 10, in <module>
> >     import resource.ui
> >   File "F:\[path]\resource\ui.py", line 84, in <module>
> >     import resource_rc
> > ImportError: No module named resource_rc
> > 
> > This is the directory structure:
> > |-- my_application.pyw*  (main application, "import resource.ui")
> > `-- resource/
> >     |-- __init__.py      (package file to enable module import)
> >     |-- resource_rc.py   (generated by pyrcc4)
> >     `-- ui.py            (generated by pyuic4, "import resource_rc")
> > 
> > I couldn't find any documentation regarding changes between the latest 
> > Python 2 and 3. Who knows what's going on and what I can do?!
> 
> Make sure you regenerate resource_rc.py with the -py3 argument to pyrcc4.

Okay, I did this now but the error remained the same.

Thorsten



More information about the PyQt mailing list