Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gdbm: ValueError: time data ... does not match format '%Y-%m-%d %H:%M:%S.%f' #20

gryphius opened this issue Aug 14, 2014 · 1 comment


Copy link

@gryphius gryphius commented Aug 14, 2014

The gdbm backend assumes that dates are stored in the format "%Y-%m-%d %H:%M:%S.%f" which is usually true:

str(datetime.datetime(2014, 8, 14, 11, 42, 17, 1337))
'2014-08-14 11:42:17.001337'

However, if a record is inserted exactly "on the second", the microseconds are removed:

str(datetime.datetime(2014, 8, 14, 11, 42, 17, 0))
'2014-08-14 11:42:17'

on busy servers this happens sometimes, and after a restart, the database can not be loaded:

Traceback (most recent call last):
  File "/usr/bin/pyzord", line 4, in <module>
    __import__('pkg_resources').run_script('pyzor==0.8.0', 'pyzord')
  File "/usr/lib/python2.7/site-packages/", line 534, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/lib/python2.7/site-packages/", line 1445, in run_script
    exec(script_code, namespace, namespace)
  File "/usr/lib/python2.7/site-packages/pyzor-0.8.0-py2.7.egg/EGG-INFO/scripts/pyzord", line 389, in <module>

  File "/usr/lib/python2.7/site-packages/pyzor-0.8.0-py2.7.egg/EGG-INFO/scripts/pyzord", line 363, in main

  File "build/bdist.linux-x86_64/egg/pyzor/engines/", line 40, in __init__
  File "build/bdist.linux-x86_64/egg/pyzor/engines/", line 100, in start_reorganizing
  File "build/bdist.linux-x86_64/egg/pyzor/engines/", line 65, in apply_method
  File "build/bdist.linux-x86_64/egg/pyzor/engines/", line 111, in _really_reorganize
  File "build/bdist.linux-x86_64/egg/pyzor/engines/", line 71, in _really_getitem
  File "build/bdist.linux-x86_64/egg/pyzor/engines/", line 143, in decode_record
  File "build/bdist.linux-x86_64/egg/pyzor/engines/", line 162, in decode_record_1
  File "build/bdist.linux-x86_64/egg/pyzor/engines/", line 23, in <lambda>
  File "/usr/lib/python2.7/", line 325, in _strptime
    (data_string, format))
ValueError: time data '2014-07-03 14:59:31' does not match format '%Y-%m-%d %H:%M:%S.%f'
Copy link

@alexkiro alexkiro commented Aug 28, 2014

Looks good, thanks @gryphius !

@alexkiro alexkiro closed this Aug 28, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.