Beispiel #1
0
     if not bad_binary and 'Internet Archive: Error' in marc_data:
         bad_binary = 'Internet Archive: Error'
     if not bad_binary:
         if str(marc_data)[6:8] != 'am':  # only want books
             print('not a book!')
             continue
         try:
             rec = fast_parse.read_edition(marc_data,
                                           accept_electronic=True)
         except:
             bad_binary = "MARC parse error"
 if bad_binary and not formats['xml']:
     load_error_mail(ia, bad_binary, 'bad MARC binary, no MARC XML')
     continue
 if not use_binary and formats['xml']:
     if bad_ia_xml(ia) and bad_binary:
         load_error_mail(ia, bad_binary,
                         'bad MARC binary, bad MARC XML')
         continue
     try:
         rec = get_ia(ia)
     except (KeyboardInterrupt, NameError):
         raise
     except NoMARCXML:
         write_log(ia, when, "no MARCXML")
         continue
     except urllib2.HTTPError as error:
         write_log(ia, when, "error: HTTPError: " + str(error))
         continue
 if not use_binary and not formats['xml']:
     print('skipping, no MARC')
Beispiel #2
0
         bad_binary = 'MARC length mismatch: %d != %d' % (len(marc_data), length)
     if not bad_binary and 'Internet Archive: Error' in marc_data:
         bad_binary = 'Internet Archive: Error'
     if not bad_binary:
         if str(marc_data)[6:8] != 'am': # only want books
             print 'not a book!'
             continue
         try:
             rec = fast_parse.read_edition(marc_data, accept_electronic = True)
         except:
             bad_binary = "MARC parse error"
 if bad_binary and not formats['xml']:
     load_error_mail(ia, bad_binary, 'bad MARC binary, no MARC XML')
     continue
 if not use_binary and formats['xml']:
     if bad_ia_xml(ia) and bad_binary:
         load_error_mail(ia, bad_binary, 'bad MARC binary, bad MARC XML')
         continue
     try:
         rec = get_ia(ia)
     except (KeyboardInterrupt, NameError):
         raise
     except NoMARCXML:
         write_log(ia, when, "no MARCXML")
         continue
     except urllib2.HTTPError as error:
         write_log(ia, when, "error: HTTPError: " + str(error))
         continue
 if not use_binary and not formats['xml']:
     print 'skipping, no MARC'
     continue