Happened again:
Traceback (most recent call last): File "find_import_works.py", line 52, in <module> to_update = update_works(akey, works, do_updates=True) File "/1/edward/src/openlibrary/openlibrary/catalog/works/find_works.py", line 644, in update_works updated = new_work(akey, w, do_updates, fh_log) File "/1/edward/src/openlibrary/openlibrary/catalog/works/find_works.py", line 472, in new_work print >> fh_log, ol.save_many(update, "add editions to new work") File "/1/edward/src/openlibrary/openlibrary/api.py", line 125, in save_many return self._call_write('save_many', query, comment, action) File "/1/edward/src/openlibrary/openlibrary/api.py", line 121, in _call_write response = self._request('/api/' + name, method="POST", data=simplejson.dumps(query), headers=headers) File "/1/edward/src/openlibrary/openlibrary/api.py", line 48, in _request raise OLError(e) OLError: Bad Request: duplicate key value violates unique constraint "version_thing_id_key"
I was trying to save this:
[{'authors': [<ref: u'/a/OL818321A'>], 'by_statement': 'Hasan Hasani.', 'created': datetime.datetime(2008, 4, 1, 3, 28, 50, 625462), 'description': <text: u'das'>, 'first_sentence': <text: u'sdasd'>, 'genres': ['Dictionaries.'], 'id': 5135390, 'key': '/b/OL3633930M', 'languages': [<ref: u'/l/alb'>], 'last_modified': datetime.datetime(2009, 7, 5, 20, 54, 49, 625713), 'latest_revision': 62, 'lc_classifications': ['CS2377 .H38 2001'], 'lccn': ['2002432668'], 'notes': <text: u'xzzc'>, 'number_of_pages': 222, 'pagination': '222 p. ;', 'publish_date': '2001', 'publish_places': [u'Prishtine\u0308'], 'publishers': [u'Shte\u0308pia Botuese Faik Konica'], 'revision': 62, 'subjects': ['Names, Personal -- Albanian -- Dictionaries.', 'Children -- Albania.'], 'table_of_contents': [{'class': 'subsection', 'type': <ref: u'/type/toc_item'>}], 'title': u'5043 emra shqip pe\u0308r fe\u0308mije\u0308', 'title_prefix': 'aa', 'type': <ref: u'/type/edition'>, 'works': [{'key': '/works/OL15112965W'}]}]
Happened again:
Traceback (most recent call last): works.py" , line 52, in <module> src/openlibrary /openlibrary/ catalog/ works/find_ works.py" , line 644, in update_works src/openlibrary /openlibrary/ catalog/ works/find_ works.py" , line 472, in new_work many(update, "add editions to new work") src/openlibrary /openlibrary/ api.py" , line 125, in save_many write(' save_many' , query, comment, action) src/openlibrary /openlibrary/ api.py" , line 121, in _call_write '/api/' + name, method="POST", data=simplejson .dumps( query), headers=headers) src/openlibrary /openlibrary/ api.py" , line 48, in _request thing_id_ key"
File "find_import_
to_update = update_works(akey, works, do_updates=True)
File "/1/edward/
updated = new_work(akey, w, do_updates, fh_log)
File "/1/edward/
print >> fh_log, ol.save_
File "/1/edward/
return self._call_
File "/1/edward/
response = self._request(
File "/1/edward/
raise OLError(e)
OLError: Bad Request: duplicate key value violates unique constraint "version_
I was trying to save this:
[{'authors': [<ref: u'/a/OL818321A'>], datetime( 2008, 4, 1, 3, 28, 50, 625462), datetime( 2009, 7, 5, 20, 54, 49, 625713), revision' : 62, ations' : ['CS2377 .H38 2001'], of_pages' : 222, u0308'] ,
'Children -- Albania.'], of_contents' : [{'class': 'subsection',
'type' : <ref: u'/type/ toc_item' >}], u0308', OL15112965W' }]}]
'by_statement': 'Hasan Hasani.',
'created': datetime.
'description': <text: u'das'>,
'first_sentence': <text: u'sdasd'>,
'genres': ['Dictionaries.'],
'id': 5135390,
'key': '/b/OL3633930M',
'languages': [<ref: u'/l/alb'>],
'last_modified': datetime.
'latest_
'lc_classific
'lccn': ['2002432668'],
'notes': <text: u'xzzc'>,
'number_
'pagination': '222 p. ;',
'publish_date': '2001',
'publish_places': [u'Prishtine\
'publishers': [u'Shte\u0308pia Botuese Faik Konica'],
'revision': 62,
'subjects': ['Names, Personal -- Albanian -- Dictionaries.',
'table_
'title': u'5043 emra shqip pe\u0308r fe\u0308mije\
'title_prefix': 'aa',
'type': <ref: u'/type/edition'>,
'works': [{'key': '/works/