crashes with "ValueError: Unknown date format" on .reporter property

Bug #188031 reported by Martin Pitt
2
Affects Status Importance Assigned to Milestone
python-launchpad-bugs
Invalid
Undecided
Martin Pitt

Bug Description

This is a script running on drescher to help us processing sync bugs in bulk.

Drescher has Python 2.4.3 (dapper), locale "C", and I am using p-lp-bugs main bzr head (r61) plus the recent patch in bug 188018. My cookie uses edge.launchpad.net.

When the script tries to access Bug(187804).reporter, I get:

  File "/home/lp_archive/bin/syncbugbot", line 56, in ?
    main()
  File "/home/lp_archive/bin/syncbugbot", line 49, in main
    process_bug(int(fields[0]), fields[1:], failed)
  File "/home/lp_archive/bin/syncbugbot", line 29, in process_bug
    print 'processing bug %i, package %s, reporter %s...' % (bug, task.sourcepackage, b.reporter)
  File "/home/lp_archive/python/launchpadbugs/lphelper.py", line 255, in <lambda>
    if fget : fget = lambda s, n=fget.__name__ : getattr(s, n)()
  File "/home/lp_archive/python/launchpadbugs/html_bug.py", line 87, in func
    x.parse()
  File "/home/lp_archive/python/launchpadbugs/html_bug.py", line 470, in parse
    self.date = LPTime(d[0].prop("title"))
  File "/home/lp_archive/python/launchpadbugs/lptime.py", line 59, in __new__
    raise ValueError, "Unknown date format (%s)" %time_str
ValueError: Unknown date format (2008-01-31 20:15:11 CET)

This also happens with other bugs (e. g. 186856)

Revision history for this message
Martin Pitt (pitti) wrote :

This command works as expected on current hardy with the hardy python-launchpad-bugs package, as well as with bzr main head (PYTHONPATH=/tmp/main/):

$ python -c "import launchpadbugs.connector as Connector; Bug = Connector.ConnectBug(); Bug.authentication = '/home/pitti/.lpcookie'; print Bug(186856).reporter"

It even works in my dapper chroot with LC_ALL=C. Thus, at the moment I'm a bit unsure what is different on drescher (our server where that sync script runs).

Changed in python-launchpad-bugs:
assignee: nobody → pitti
status: New → Incomplete
Revision history for this message
Martin Pitt (pitti) wrote :

I augmented lptime.py with some debugging output:

        for i in conv_functions:
            try:
                print 'trying conv_function %s on %s' % (str(i), time_str)
                t = i(time_str)
                print 'success!'
                break
            except (ValueError, TypeError), e:
                print 'fail:', e
                continue
        else:
            raise ValueError, "Unknown date format (%s)" %time_str

on my workstation:
trying conv_function <function convert_rfc2822_time at 0xdd3b18> on 2008-01-29 00:39:09 CET
fail: 'NoneType' object is unsubscriptable
trying conv_function <function convert_text_time at 0xdd3cf8> on 2008-01-29 00:39:09 CET
fail: time data did not match format: data=2008-01-29 00:39:09 CET fmt=%a, %d %b %Y %H:%M:%S -0000
trying conv_function <function convert_html_time at 0xdd3e60> on 2008-01-29 00:39:09 CET
success!
mathiaz

on drescher:
trying conv_function <function convert_rfc2822_time at 0x2aaaad303ed8> on 2008-01-29 00:39:09 CET
fail: unsubscriptable object
trying conv_function <function convert_text_time at 0x2aaaad303f50> on 2008-01-29 00:39:09 CET
fail: time data did not match format: data=2008-01-29 00:39:09 CET fmt=%a, %d %b %Y %H:%M:%S -0000
trying conv_function <function convert_html_time at 0x2aaaad731050> on 2008-01-29 00:39:09 CET
fail: time data did not match format: data=2008-01-29 00:39:09 CET fmt=%Y-%m-%d %H:%M:%S %Z
trying conv_function <function convert_activity_time at 0x2aaaad7310c8> on 2008-01-29 00:39:09 CET
fail: time data did not match format: data=2008-01-29 00:39:09 CET fmt=%d %b %y %H:%M
trying conv_function <function convert_lastcomment_time at 0x2aaaad731140> on 2008-01-29 00:39:09 CET
fail: unconverted data remains: 00:39:09 CET

Thus I tried the strptime() call in convert_html_time() directly:

>>> print time.strptime("2008-01-29 00:39:09 CET", "%Y-%m-%d %H:%M:%S %Z")
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.4/_strptime.py", line 293, in strptime
    raise ValueError("time data did not match format: data=%s fmt=%s" %
ValueError: time data did not match format: data=2008-01-29 00:39:09 CET fmt=%Y-%m-%d %H:%M:%S %Z

Thus this is clearly an installation problem on drescher, not a p-lp-bug any more. Sorry for the noise.

Changed in python-launchpad-bugs:
status: Incomplete → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.