mc2skos icon indicating copy to clipboard operation
mc2skos copied to clipboard

AttributeError when mapping 5XX fields

Open CaptSolo opened this issue 5 years ago • 1 comments

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 avatar May 18 '20 13:05 CaptSolo

Example MARC XML data file attached.

150_record-2.txt

CaptSolo avatar May 18 '20 13:05 CaptSolo