[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: [PyQt] pyuic4 can't properly recognize and set the correct encoding
From: Omid Raha <omidraha.com () gmail ! com>
Date: 2010-08-31 12:37:31
Message-ID: AANLkTimuq7zDMaxLJ=WTpyDy9rJBNbKiYupLN+xp6YEa () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
Hi ,
In some windows systems that the default python encoding is not set to utf-8
,
for example is ascii , and use PyQt Designer 4.7.4 with Python 3.1.1 ,
when you design an UI that content Unicode data with Designer , and save it
in a file such as example.ui ,
then when you try to convert it by "pyuic4" to a python file such as
ui_example.py ,
Since Python Standard Input is not set to unicode , so pyuic4(pyuic.py)
Faced with the problem :
#pyuic4 -o ui_example.py example.ui
An unexpected error occurred.
Check that you are using the latest version of PyQt and send an error report
to
<email address hidden>, including the following information:
* your version of PyQt (4.7.2)
* the UI file that caused this error
* the debug output of pyuic4 (use the -d flag when calling pyuic4)
Precisely the error is related to the this file :
/Python.3.1.1/Lib/site-packages/PyQt4/uic/driver.py
and in this line (59) :
pyfile = open(self._opts.output, 'wt')
So I modified it to it :
pyfile = open(self._opts.output, 'wt',encoding='utf-8')
And the problem was resolved , temporarily .
--
Omid Raha
[Attachment #5 (text/html)]
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta \
name="ProgId" content="Word.Document"><meta name="Generator" content="Microsoft Word \
11"><meta name="Originator" content="Microsoft Word 11"><link rel="File-List" \
href="file:///C:%5CDOCUME%7E1%5CWinPc%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml"><style>
<!--
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-parent:"";
margin:0in;
margin-bottom:.0001pt;
text-align:right;
mso-pagination:widow-orphan;
direction:rtl;
unicode-bidi:embed;
font-size:12.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:"Times New Roman";}
p
{mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:"Times New Roman";}
span.shorttext
{mso-style-name:short_text;}
@page Section1
{size:8.5in 11.0in;
margin:1.0in 1.25in 1.0in 1.25in;
mso-header-margin:.5in;
mso-footer-margin:.5in;
mso-paper-source:0;}
div.Section1
{page:Section1;}
-->
</style>
<p class="MsoNormal" style="text-align: left; direction: ltr; unicode-bidi: \
embed;">Hi , <span dir="RTL" lang="FA"></span></p>
<p class="MsoNormal" style="text-align: left; direction: ltr; unicode-bidi: \
embed;"><span dir="RTL" lang="FA"> </span></p>
<p class="MsoNormal" style="text-align: left; direction: ltr; unicode-bidi: \
embed;">In some windows systems that the default python encoding is not set to utf-8 \
, <br></p><p class="MsoNormal" style="text-align: left; direction: ltr; unicode-bidi: \
embed;"><br></p><p class="MsoNormal" style="text-align: left; direction: ltr; \
unicode-bidi: embed;"> for
example is ascii , and use<span style=""> </span>PyQt Designer
4.7.4<span style=""> </span>with<span style=""> </span>Python 3.1.1 ,</p>
<p class="MsoNormal" style="text-align: left; direction: ltr; unicode-bidi: embed;"> \
</p>
<p class="MsoNormal" style="text-align: left; direction: ltr; unicode-bidi: \
embed;">when <span style=""> </span>you <span class="shorttext"><span style="color: \
black; background: none repeat scroll 0% 0% white;">design</span></span> an UI that \
content Unicode data with <span class="shorttext"><span style="color: black; \
background: none repeat scroll 0% 0% white;">Designer</span></span> , and save it in \
a file such as example.ui ,</p>
<p class="MsoNormal" style="text-align: left; direction: ltr; unicode-bidi: embed;"> \
</p>
<p class="MsoNormal" style="text-align: left; direction: ltr; unicode-bidi: \
embed;">then <span class="shorttext">when you try to convert it by "pyuic4" \
to a python file <span style=""> </span>such as ui_example.py ,</span></p>
<p class="MsoNormal" style="text-align: left; direction: ltr; unicode-bidi: \
embed;"><span class="shorttext"> </span></p>
<p class="MsoNormal" style="text-align: left; direction: ltr; unicode-bidi: \
embed;"><span class="shorttext">Since Python Standard Input is not set to unicode , \
so<span style=""> </span>pyuic4(pyuic.py) Faced with the problem :</span></p>
<p><span style="color: maroon;">#pyuic4 -o <span class="shorttext">ui_example.py \
</span><span style=""> </span>example.ui<br> An unexpected error occurred.<br>
Check that you are using the latest version of PyQt and send an error report to<br>
<email address hidden>, including the following information:</span></p>
<p><span style="color: maroon;"> * your version of PyQt (4.7.2)<br>
* the UI file that caused this error<br>
* the debug output of pyuic4 (use the -d flag when calling pyuic4)</span></p>
<p class="MsoNormal" style="text-align: left; direction: ltr; unicode-bidi: embed;"> \
</p>
<p class="MsoNormal" style="text-align: left; direction: ltr; unicode-bidi: \
embed;"><span class="shorttext">Precisely the error is related to the this file \
:</span></p>
<p class="MsoNormal" style="text-align: left; direction: ltr; unicode-bidi: embed;"> \
</p>
<p class="MsoNormal" style="text-align: left; direction: ltr; unicode-bidi: \
embed;"><span style="color: \
maroon;">/Python.3.1.1/Lib/site-packages/PyQt4/uic/driver.py</span></p>
<p class="MsoNormal" style="text-align: left; direction: ltr; unicode-bidi: embed;"> \
</p>
<p class="MsoNormal" style="text-align: left; direction: ltr; unicode-bidi: \
embed;">and in this line (59) :</p>
<p class="MsoNormal" style="text-align: left; direction: ltr; unicode-bidi: embed;"> \
</p>
<p class="MsoNormal" style="text-align: left; direction: ltr; unicode-bidi: \
embed;"><span style="color: maroon;">pyfile = open(self._opts.output, \
'wt')</span></p>
<p class="MsoNormal" style="text-align: left; direction: ltr; unicode-bidi: \
embed;"><span style="color: maroon;"> </span></p>
<p class="MsoNormal" style="text-align: left; direction: ltr; unicode-bidi: \
embed;"><span class="shorttext">So I modified it <span style=""> </span>to it \
:</span></p>
<p class="MsoNormal" style="text-align: left; direction: ltr; unicode-bidi: embed;"> \
</p>
<p class="MsoNormal" style="text-align: left; direction: ltr; unicode-bidi: \
embed;"><span style="color: maroon;">pyfile = open(self._opts.output, \
'wt',encoding='utf-8')</span></p>
<p class="MsoNormal" style="text-align: left; direction: ltr; unicode-bidi: \
embed;"><span style="color: maroon;"> </span></p>
<p class="MsoNormal" style="text-align: left; direction: ltr; unicode-bidi: \
embed;"><span style="color: maroon;"> </span></p>
<p class="MsoNormal" style="text-align: left; direction: ltr; unicode-bidi: \
embed;"><span class="shorttext"><span style="background: none repeat scroll 0% 0% \
white;">And the problem was resolved</span></span> , t<span \
class="shorttext">emporarily .</span></p>
<br><br clear="all"><span style="color: rgb(192, 192, 192);">--</span><br \
style="color: rgb(192, 192, 192);"><span style="color: rgb(192, 192, 192);">Omid \
<span style="color: rgb(102, 102, 102);">Raha</span></span><br><br> <br><br>
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic