[PyQt] pyuic4 can't properly recognize and set the correct encoding .

Omid Raha omidraha.com at gmail.com
Tue Aug 31 13:25:31 BST 2010


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20100831/cf1a7615/attachment.html>


More information about the PyQt mailing list