[Eric] 2 flaws when follow this tutorial

Jaime Seuma jaims.seuma at gmail.com
Sun Jun 2 22:02:33 BST 2013


Hello iMath,

it is very kind of you to go through all the trouble of detecting the flaws
and the causes originated them.
I guess that I should have emphasized in the tutorial that it was made for
eric4; I wrote it before eric5 was released.
If memory serves, the procedures detailed in the tutorial used to work fine
with eric4; no errors whatsoever when running the project...

I haven't actually tried to run the tutorial from within eric5, but it is
possible that there are slight differences between eric4 and eric5 when it
comes to the structure of the project, etc.
All in all, I still think that the tutorial is useful since it provides
some guidelines for the newbie to work with the eric IDE.

Then again, maybe some day I'll have the time to update the tutorial for
the current eric5 version (?).

Regards,

Jaime




On 22 May 2013 16:09, iMath <2281570025 at qq.com> wrote:

> I have found 2 flaws in this tutorial ,here is the solutions .****
> http://eric-ide.python-projects.org/tutorials/MiniBrowser/index.html
>
> 1)      change the folder nam ‘ui’ to ‘UI ’****
>
> 2)      do not use main script as the starter of the program ,i.e. not
> created it in your project****
>
>
>
> the reason is as following
>
> eric5 unhandled ImportErro: No module named icon_rc****
>
> in order to set the window icon ,I used resource files ,then this error
> occurred when run the project through the main script ,why this error and
> how to fix it ?****
>
> my project diagram structure is like this ****
>
>
>
>
>
>
>
>
>
> this is because eric5 leads us to create the main script in the top
> directory of the project ,but the qrc script is imported in the
> Ui_MainWindow by this statement ****
>
>
>
> import icon_rc****
>
>
>
> this is a relative import and because the qrc script and Ui_MainWindow.py
> are in the same directory ,so when you run Ui_MainWindow.py directly ,it
> works ok ,but when you run your program through the main script ,this
> relative relationship broken ,because the main script is not in the same
> directory as the qrc script in (and also you cannot put the qrc script with
> the main script in the top folder ,why ?) ,so this error occurred .one way
> to solve this problem is to change that statement to ****
>
>
>
> import ui.icon_rc****
>
>
>
> then it works.****
>
> wait !!!have you noticed the state tip besides ?****
>
>
>
> ui = Ui_MainWindow()****
>
> Warning :Redefinition of unused ‘ui’ from line XXX ****
>
>
>
> this is because the folder that Ui_MainWindow.py resides in is also named
> ‘ui’ ,they are conflicted ,so in order to avoid this problem and if you
> still want to use ‘ui ’ as the folder name ,you can use upper-case lettersto rename
> it as ‘UI ’.****
>
>
>
> another way to solve this issue is not to use main script as the starter
> of the program ,i.e. not created it in your project ,just port the code
> that you would have put in the main script to MainWindow.py ,only for one
> reason : if you do this ,you won’t encouraged the issues that I
> aforementioned ,also when you recomplie the ui file ,****
>
>
>
>  import ui.icon_rc ****
>
>
>
> will become back to****
>
>
>
>  import icon_rc
>
>
> so dizzy , isn’t it ? ****
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/eric/attachments/20130602/0fe69da1/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 6552BEEC at D00D0910.94D19C51.jpg
Type: image/jpeg
Size: 10491 bytes
Desc: not available
URL: <http://www.riverbankcomputing.com/pipermail/eric/attachments/20130602/0fe69da1/attachment.jpg>


More information about the Eric mailing list