[New-bugs-announce] [issue22690] importing Gtk breaks strptime

Sigz report at bugs.python.org
Tue Oct 21 23:37:22 CEST 2014

New submission from Sigz:

I usually convert date string to time with strptime formating. I noticed importing Gtk breaks strptime parsing for abbreviated month name and weekday name :

>>> import time
>>> time.strptime("Mon, 20 Oct 2014 08:00:32 +0000", "%a, %d %b %Y %H:%M:%S %z")
time.struct_time(tm_year=2014, tm_mon=10, tm_mday=20, tm_hour=8, tm_min=0, tm_sec=32, tm_wday=0, tm_yday=293, tm_isdst=-1)
>>> from gi.repository import Gtk
>>> time.strptime("Mon, 20 Oct 2014 08:00:32 +0000", "%a, %d %b %Y %H:%M:%S %z")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.4/_strptime.py", line 494, in _strptime_time
    tt = _strptime(data_string, format)[0]
  File "/usr/lib/python3.4/_strptime.py", line 337, in _strptime
    (data_string, format))
ValueError: time data 'Mon, 20 Oct 2014 08:00:32 +0000' does not match format '%a, %d %b %Y %H:%M:%S %z'

Is there a workaround for Gtk + time ?

components: Extension Modules
messages: 229794
nosy: sigzegv
priority: normal
severity: normal
status: open
title: importing Gtk breaks strptime
type: crash
versions: Python 3.4

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list