[PyQt] Can't load UI files under Turkish locale

Giovanni Bajo rasky at develer.com
Thu Aug 2 12:17:48 BST 2007


On 8/2/2007 1:08 PM, Ismail Dönmez wrote:

> uic/properties.py line 220 says :
> 
> getattr(widget, "set%s%s" % (propname[0].upper(), propname[1:]))(
> 
> The propname[0].upper() part is problematic for Turkish locale, because 
> uppercase of "i" is not "I" in Turkish locale but its i-with-a-dot-above 
> (İ) .
> 
> So trying to load a UI file results in an error :
> 
>   File "/usr/lib/python2.4/site-packages/PyQt4/uic/properties.py", line 220, 
> in setProperties
>     getattr(widget, "set%s%s" % (propname[0].upper(), propname[1:]))(
> AttributeError: seticon
> 
> Notice the method name is seticon and not setIcon. Somehow ascii only upper 
> should be done, something like :
> 
> import ascii
> 
> def ascii_upper(s):
> 	trans_table = string.maketrans(string.ascii_lowercase, 
> string.ascii_uppercase)
> 	return s.translate(trans_table)
> 
> What do you think?

Python's default locale is "C". If you run a the Python interpreter (in 
a non-broken Python distribution), and you run "i".upper() it will 
*always* return "I".

So, how are you executing uic? Are you using it from within your 
program, where you changed Python's locale?
-- 
Giovanni Bajo





More information about the PyQt mailing list