For example I have this simple class:
from PyQt4 import QtGui, QtCore
import sys
from datetime import datetime
print datetime.strptime('Wed, 06-Feb-2014 12:05:12', '%a, %d-%b-%Y %H:%M:%S')
class Application(QtGui.QWidget):
def __init__(self):
super(Application, self).__init__()
print datetime.strptime('Wed, 06-Feb-2014 12:05:12', '%a, %d-%b-%Y %H:%M:%S')
def main():
app = QtGui.QApplication(sys.argv)
ex = Application()
sys.exit(app.exec_())
if __name__ == '__main__':
main()
When I run it I have the following output:
2014-02-06 12:05:12
Traceback (most recent call last):
File "vkPlayListSync.py", line 23, in <module>
main()
File "vkPlayListSync.py", line 18, in main
ex = Application()
File "vkPlayListSync.py", line 12, in __init__
print datetime.strptime('Wed, 06-Feb-2014 12:05:12', '%a, %d-%b-%Y %H:%M:%S')
File "/usr/lib/python2.7/_strptime.py", line 325, in _strptime
(data_string, format))
ValueError: time data 'Wed, 06-Feb-2014 12:05:12' does not match format '%a, %d-%b-%Y %H:%M:%S'
so the first line with strptime, but the second call form the class __init()__ method throws error. I have not enough experience in Python and PyQt, so can’t understand how to fix this. And I haven’t found the answer here on stackoverflow or in google.
QApplicationstartup is altering your locale such that'Wed, 06-Feb-2014 12:05:12'is no longer a valid date (i.e. the weekday and month names are in another language). Try running your application withLC_ALL="C".