Hi

I am extracting strings containing dates from some files in a pyqt app, and I 
want to use datetime.strptime to format them.

But this won't work as Qapplication seem to alter my locales. I found this 
topic :

http://stackoverflow.com/questions/14684513/datetime-strptime-doesnt-work-in-pyqt4-qtgui-qwidget-inherited-class

So if I use : os.putenv("LANG", "C"), it will indeed work.

My questions are the following :

- Why does PyQt change the locales ? Is there some documentation on this I 
could read ?
More "pythonic" questions, but related to the problem :
- Is it OK to use os.putenv on all platforms ? The python documentation says it 
is not always provided. (locale.setlocale is platform dependent).
Setting the value directly in os.environ may causes memory leaks on some 
platforms.
- Are there some specific problems I could have if I use the "C" option ? What 
will be the influence on the pyqt app ?
- Is there perhaps a known alternative to datetime.strptime, where I can define 
the locale temporarily or which works with pyqt ?

Thanks in advance

Michka Popoff

_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to