Public bug reported:

This code:

#!/usr/bin/env python
import pynotify
import time
import datetime
c='5/1/12 1:15 PM'
print c
dt = time.strptime(c, "%d/%m/%y %H:%M %p")

produces:

5/1/12 1:15 PM
Traceback (most recent call last):
  File "tmp.py", line 9, in <module>
    dt = time.strptime(c, "%d/%m/%y %H:%M %p")
  File "/usr/lib/python2.7/_strptime.py", line 454, in _strptime_time
    return _strptime(data_string, format)[0]
  File "/usr/lib/python2.7/_strptime.py", line 328, in _strptime
    data_string[found.end():])
ValueError: unconverted data remains: PM
Removing the import pynotify,

#!/usr/bin/env python
import time
import datetime
c='5/1/12 1:15 PM'
print c
dt = time.strptime(c, "%d/%m/%y %H:%M %p")


causes no error. 

It appears to be as a result of a non en_US locale. My locale is
currently set to nb_NO.UTF-8. Setting this to en_US.UTF-8 fixes the
issue.

** Affects: notify-python (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/993096

Title:
  strptime gives "unconverted data remains" for non en_US locale

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/notify-python/+bug/993096/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to