Skip to content

Instantly share code, notes, and snippets.

View adjam's full-sized avatar
💭
Setting my GitHub status

Adam Constabaris adjam

💭
Setting my GitHub status
  • NC State University Libraries
View GitHub Profile
@anarchivist
anarchivist / permissive.py
Created November 24, 2012 22:36
Permissive MARC Reader subclass for pymarc
import pymarc
from pymarc.exceptions import RecordLengthInvalid, RecordLeaderInvalid
from pymarc.exceptions import BaseAddressInvalid, BaseAddressNotFound
from pymarc.exceptions import RecordDirectoryInvalid, NoFieldsFound
class PermissiveMARCReader(pymarc.MARCReader):
"""PermissiveMARCReader: recovers from most pymarc exceptions"""
def __init__(self, marc_target, to_unicode=False, force_utf8=False,
hide_utf8_warnings=False, utf8_handling='strict'):
super(PermissiveMARCReader,self).__init__(marc_target, to_unicode,