Re: Slightly OT - using PyUIC from Eclipse

Discussion in 'Python' started by Fabio Zadrozny, Apr 30, 2014.

  1. On Wed, Apr 30, 2014 at 8:39 AM, Steve Simmons <>wrote:

    > I'm trying to set up a new dev environment using Windows 7; Eclipse
    > (Kepler); Python 3.3; PyDev and PyQt 5 and I've hit an issue getting PyUIC
    > to generate a python Qt class from within Eclipse.
    >
    > I'm using the following setup process (from Google Groups) modified to
    > match my PyQt5 configuration:
    >
    > 1. Click Run -> External Tools -> External Tools Configurations ...
    > 2. In the resulting dialog, click 'New' icon in the top left
    > 3. Under 'Name' put 'PyUIC'
    > 4. Under 'Location' enter 'C:\Program Files\Python\2.5\Python.exe' or
    > the path to your Python executable (probably C:\Python25\Python.exe)
    > 5. Under 'Arguments' enter '"C:\Program Files\Python\2.5\Lib\site-
    > packages\PyQt4\uic\pyuic.py" "${resource_loc}"' substituting the path
    > to your PyQt4 installation - be sure also to include the double quotes
    > 6. Change to the 'Common' tab and check 'File' under 'Standard Input/
    > Output' and enter '${resource_loc}.py'
    > 7. Change to the 'Build' tab and uncheck 'Build before launch'
    > 8. Change to the 'Refresh' tab and check 'Refresh resources upon
    > completion'
    > 9. Click 'Apply' then 'Run'
    >
    > and I'm getting the following traceback:
    >
    > Traceback (most recent call last):
    > File "D:\Development\Python33\Lib\site-packages\PyQt5\uic\pyuic.py",
    > line 28, in <module>
    > from .driver import Driver
    > SystemError: Parent module '' not loaded, cannot perform relative import
    >
    > I tried this on Qt4 a week or so ago and it worked OK but Qt5 is giving me
    > an error message, so I guess I've either mis-transcribed or there's a
    > difference in the directory structure betwee PyQt4 & PyQt5.
    >
    > I'm more interested to learn how to read the traceback (insightfully) and
    > track it to the source of the problem, although it would be good to have it
    > working too!!
    >
    > Steve Simmons
    >
    > PS Also posted to PyQT list.
    > --
    > https://mail.python.org/mailman/listinfo/python-list
    >



    The problem is that a main module cannot perform relative imports on
    Python. To overcome that limitation, Python created a workaround to execute
    a module with:

    python -m 'module.name'

    So, If you execute Python as:

    python -m PyQt5.uic.pyuic

    (instead of "python C:\Program
    Files\Python\2.5\Lib\site-packages\PyQt5\uic\pyuic.py")

    it should work.

    If you want, you can read an answer on
    http://stackoverflow.com/questions/14132789/python-relative-imports-for-the-billionth-timefor
    more details on why it doesn't work and the other way does...

    Cheers,

    Fabio
    Fabio Zadrozny, Apr 30, 2014
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dave
    Replies:
    3
    Views:
    356
  2. Christopher Grinde

    pyuic for qtdesigner 3.3

    Christopher Grinde, Apr 30, 2004, in forum: Python
    Replies:
    2
    Views:
    475
    David Boddie
    Apr 30, 2004
  3. Madhusudan Singh

    pyuic and Qt Designer plugins

    Madhusudan Singh, Aug 9, 2005, in forum: Python
    Replies:
    0
    Views:
    440
    Madhusudan Singh
    Aug 9, 2005
  4. Steve Simmons

    Slightly OT - using PyUIC from Eclipse

    Steve Simmons, Apr 30, 2014, in forum: Python
    Replies:
    0
    Views:
    72
    Steve Simmons
    Apr 30, 2014
  5. Steve Simmons

    Re: Slightly OT - using PyUIC from Eclipse

    Steve Simmons, May 1, 2014, in forum: Python
    Replies:
    3
    Views:
    80
    Steve Simmons
    May 1, 2014
Loading...

Share This Page