<div dir="ltr">Hello iMath,<div><br></div><div style>it is very kind of you to go through all the trouble of detecting the flaws and the causes originated them.</div><div style>I guess that I should have emphasized in the tutorial that it was made for eric4; I wrote it before eric5 was released.</div>
<div style>If memory serves, the procedures detailed in the tutorial used to work fine with eric4; no errors whatsoever when running the project...</div><div style><br></div><div style>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.</div>
<div style>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.</div><div style><br></div><div style>Then again, maybe some day I'll have the time to update the tutorial for the current eric5 version (?).</div>
<div style><br></div><div style>Regards,</div><div style><br></div><div style>Jaime</div><div style><br></div><div style><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On 22 May 2013 16:09, iMath <span dir="ltr"><<a href="mailto:2281570025@qq.com" target="_blank">2281570025@qq.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im"><div><p class="MsoNormal"><span lang="EN-US">I have found 2 flaws in this tutorial ,here
is the solutions .<u></u><u></u></span></p></div><div><a href="http://eric-ide.python-projects.org/tutorials/MiniBrowser/index.html" target="_blank">http://eric-ide.python-projects.org/tutorials/MiniBrowser/index.html</a></div>
<div><br></div></div><div><div class="im"><p style="margin-left:18.0pt"><span lang="EN-US">1)<span style="font-size:7pt;line-height:normal;font-family:'Times New Roman'">      
</span></span><span lang="EN-US">change the folder nam ‘ui’ to ‘UI
’<u></u><u></u></span></p>

<p style="margin-left:18.0pt"><span lang="EN-US">2)<span style="font-size:7pt;line-height:normal;font-family:'Times New Roman'">      
</span></span><span lang="EN-US" style="font-size:9.0pt;color:#434343">do not use main script as the starter
of the program ,i.e. not created it in your project</span><span lang="EN-US"><u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US"> </span></p>

<p class="MsoNormal"><span lang="EN-US">the reason is as following</span></p><p class="MsoNormal"><span lang="EN-US">eric5 
unhandled ImportErro: No module named icon_rc<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US">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 ?<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US">my project diagram structure is like this <u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US"> </span></p>

</div><p class="MsoNormal"><span lang="EN-US"> </span><img src="cid:6552BEEC@D00D0910.94D19C51.jpg" style="line-height:1.5"></p><div class="im">

<p class="MsoNormal"><span lang="EN-US"> </span></p>

<p class="MsoNormal"><span lang="EN-US"> </span></p>

<p class="MsoNormal"><span lang="EN-US">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 <u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US"> </span></p>

<p class="MsoNormal"><span lang="EN-US">import icon_rc<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US"> </span></p>

<p class="MsoNormal"><span lang="EN-US">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 <u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US"> </span></p>

<p class="MsoNormal"><span lang="EN-US">import ui.icon_rc<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US"> </span></p>

<p class="MsoNormal"><span lang="EN-US">then it works.<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US">wait !!!have you noticed the state tip
besides ?<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US"> </span></p>

<p class="MsoNormal"><span lang="EN-US">ui = Ui_MainWindow()<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US">Warning :Redefinition of unused ‘ui’ from
line XXX <u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US"> </span></p>

<p class="MsoNormal"><span lang="EN-US">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 </span><span lang="EN-US" style="font-size:9.0pt;color:#434343">upper</span>-case
<span>letters</span> to <span lang="EN-US">rename it as</span><span lang="EN-US" style="font-size:9.0pt;color:#434343">
‘UI ’.<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;color:#434343"> </span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt">another
way to solve this issue is <span style="color:#434343">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 </span></span><span lang="EN-US">MainWindow.py</span><span lang="EN-US" style="font-size:9.0pt;color:#434343"> ,only for one reason : if you
do this ,you won’t encouraged the issues that I aforementioned ,also when you
recomplie the ui file ,<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;color:#434343"> </span></p>

<p class="MsoNormal"><span lang="EN-US"> import
ui.icon_rc <u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US"> </span></p>

<p class="MsoNormal"><span lang="EN-US">will become back to<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US"> </span></p>

<p class="MsoNormal"><span lang="EN-US"><span style="line-height:1.5"> </span><span style="line-height:1.5">import
icon_rc</span></span></p><p class="MsoNormal"><span lang="EN-US"><br></span></p><p class="MsoNormal"><span lang="EN-US"><span style="line-height:1.5">so</span><span style="line-height:1.5;color:red"> dizzy </span><span style="line-height:1.5">,
isn’t it ?</span> <u></u><u></u></span></p></div></div></blockquote></div><br></div>