[PyQt] Python 3 import error
Hans-Peter Jansen
hpj at urpla.net
Thu Dec 2 11:49:17 GMT 2010
On Thursday 02 December 2010, 12:24:54 Thorsten Kampe wrote:
> Hi,
>
> 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?!
Did you recreated the resources with pyrcc4 -py3? It might be necessary
to supply a --from-imports argument to pyuic4, as python3 did changed
its import behavior (relative imports, etc..).
Pete
More information about the PyQt
mailing list