Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python.': 0.02; 'resulting': 0.04; 'dev': 0.07; 'modified': 0.07; 'skip:" 60': 0.07; 'steve': 0.09; '(instead': 0.09; 'executable': 0.09; 'loaded,': 0.09; 'subject:using': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'posted': 0.15; 'windows': 0.15; '"python': 0.16; "'arguments'": 0.16; "'build'": 0.16; '->': 0.16; 'cc:name:python list': 0.16; 'eclipse': 0.16; 'fabio': 0.16; 'icon': 0.16; 'imports': 0.16; 'skip:f 60': 0.16; 'subject:Slightly': 0.16; 'substituting': 0.16; 'tab': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'module': 0.19; 'trying': 0.19; 'import': 0.22; 'email addr:gmail.com>': 0.22; 'cc:addr:python.org': 0.22; 'installation': 0.23; 'error': 0.23; 'driver': 0.24; 'cheers,': 0.24; 'environment': 0.24; 'cc:2**0': 0.24; "i've": 0.25; 'source': 0.25; 'header:In-Reply-To:1': 0.27; 'tried': 0.27; 'external': 0.29; 'skip:p 30': 0.29; 'am,': 0.29; "doesn't": 0.30; 'relative': 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'url:mailman': 0.30; 'work.': 0.31; 'getting': 0.31; "skip:' 10": 0.31; 'quotes': 0.31; 'skip:& 70': 0.31; 'workaround': 0.31; 'file': 0.32; 'class': 0.32; 'run': 0.32; 'worked': 0.33; 'url:python': 0.33; '(most': 0.33; 'ago': 0.33; 'guess': 0.33; 'subject:from': 0.34; 'problem': 0.35; 'created': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'google': 0.35; 'url:listinfo': 0.36; 'url:org': 0.36; 'should': 0.36; 'so,': 0.37; 'list.': 0.37; 'skip:& 10': 0.38; 'issue': 0.38; 'track': 0.38; 'recent': 0.39; '(from': 0.39; 'structure': 0.39; 'sure': 0.39; 'either': 0.39; 'skip:p 20': 0.39; 'url:mail': 0.40; 'how': 0.40; 'read': 0.60; 'new': 0.61; 'more': 0.64; '30,': 0.65; 'skip:f 50': 0.65; 'to:addr:gmail.com': 0.65; 'details': 0.65; 'within': 0.65; 'overcome': 0.74; 'click': 0.77; 'as:': 0.81; "'new'": 0.84; '(probably': 0.84; 'simmons': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=Bmyuml7K7iIdUakPqGB66r7MEXD+eqoczdlIhbJaK8M=; b=EO76fcCYA8+akFCbrR5EbUpgc5Q8xc1DO9+QvOxdiWMgTu7KAaBQGCjE2XzATDBWcO h41m0IatZ7Ga2ieUU7KuD8RKDa+sXP7Xibc9YxqN5naa2LFdWuCTud9vym9xOfT+4OOz 5jLsi4CV7fYbR07rwAdPcxa0OtVgPQFVNeqwsCoH/tQeLQPSbuPVu9eXmxE8xpenuRuS 35Dr3KiebftoGgcImzxqcrhhGE8A8IXa5sWg/Ze9WpjbkCSsocVndV+CDSQYUVc7EoWt UrE0TYwIv2vo1IhC3B++pGRafzlEJDWccy3bMuTzmdJho3mqUbHFVG27glGf2ckAmhEh 8W8A== X-Received: by 10.58.171.229 with SMTP id ax5mr5652030vec.24.1398898202824; Wed, 30 Apr 2014 15:50:02 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <5360E0FC.70802@gmail.com> References: <5360E0FC.70802@gmail.com> From: Fabio Zadrozny Date: Wed, 30 Apr 2014 19:49:42 -0300 Subject: Re: Slightly OT - using PyUIC from Eclipse To: square.steve@gmail.com Content-Type: multipart/alternative; boundary=047d7b675e6674d6b404f84a5eeb Cc: python list X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 163 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1398898211 news.xs4all.nl 2871 [2001:888:2000:d::a6]:36486 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:70791 --047d7b675e6674d6b404f84a5eeb Content-Type: text/plain; charset=UTF-8 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 > 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 --047d7b675e6674d6b404f84a5eeb Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

= On Wed, Apr 30, 2014 at 8:39 AM, Steve Simmons <square.steve@gmail.co= m> 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) =C2=A0modifi= ed 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.e= xe' or
the path to your Python executable (probably C:\Python25\Python.exe)
5. Under 'Arguments' enter '"C:\Program Files\Python\2.5\L= ib\site-
packages\PyQt4\uic\pyuic.py" =C2=A0"${resource_loc}"' su= bstituting the path
to your PyQt4 installation - be sure also to include the double quotes
6. Change to the 'Common' tab and check 'File' under 'S= tandard Input/
Output' and enter '${resource_loc}.py'
7. Change to the 'Build' tab and uncheck 'Build before launch&#= 39;
8. Change to the 'Refresh' tab and check 'Refresh resources upo= n
completion'
9. Click 'Apply' then 'Run'

and I'm getting the following traceback:

Traceback (most recent call last):
=C2=A0 File "D:\Development\Python33\Lib\site-packages\PyQt5\ui= c\pyuic.py",
line 28, in <module>
=C2=A0 =C2=A0 from .driver import Driver
SystemError: Parent module '' not loaded, cannot perform relative i= mport

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) a= nd 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 t= hat limitation, Python created a workaround to execute a module with:

python -m 'module.name'
<= br>
So, If you execute Python as:

python -m PyQt5.uic.pyuic

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

it should wor= k.

If you want, you can read an ans= wer on http://stackoverflow.com/questions/14132= 789/python-relative-imports-for-the-billionth-time for more details on = why it doesn't work and the other way does...

Cheer= s,

Fabio

--047d7b675e6674d6b404f84a5eeb--