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

Phil Thompson phil at riverbankcomputing.com
Fri Sep 3 10:23:16 BST 2010


On Tue, 31 Aug 2010 16:55:31 +0430, Omid Raha <omidraha.com at gmail.com>
wrote:
> 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 .

Changed in tonight's snapshot.

Thanks,
Phil


More information about the PyQt mailing list