scriptotek / mc2skos

Command line script for converting Marc21 Classification and Authority records to SKOS/RDF
The Unlicense
21 stars 4 forks source link

AttributeError when mapping 5XX fields #68

Open CaptSolo opened 4 years ago

CaptSolo commented 4 years ago

Program fails with an AttributeError when mapping 5XX fields in case if subfield "4" is not present:

  File "virtual-env/to-SKOS/lib/python3.7/site-packages/mc2skos/record.py", line 597, in __init__
    super(AuthorityRecord, self).__init__(record, options)
  File "virtual-env/to-SKOS/lib/python3.7/site-packages/mc2skos/record.py", line 70, in __init__
    self.parse(options or {})
  File "virtual-env/to-SKOS/lib/python3.7/site-packages/mc2skos/record.py", line 691, in parse
    elif sf_w == 'r' and is_uri(sf_4):
  File "virtual-env/to-SKOS/lib/python3.7/site-packages/mc2skos/util.py", line 2, in is_uri
    return value.startswith('http://') or value.startswith('https://')
AttributeError: 'NoneType' object has no attribute 'startswith'

Would it be possible to "fall back" to some default scheme (e.g. the scheme supplied in cmd line parameters) instead of failing with error in cases when subfield "0" does not have a URI and there is no subfield "4"?

CaptSolo commented 4 years ago

Example MARC XML data file attached.

150_record-2.txt