manusimidt / py-xbrl

Python-based parser for parsing XBRL and iXBRL files
https://py-xbrl.readthedocs.io/en/latest/
GNU General Public License v3.0
100 stars 37 forks source link

KeyError: 'Unit_sqft' #74

Closed mrx23dot closed 2 years ago

mrx23dot commented 2 years ago

doing https://www.sec.gov/Archives/edgar/data/0000740664/000114420419013512/rfil-20190131.xml

gives:

Traceback (most recent call last):
  File "small_test.py", line 11, in <module>
    inst = XbrlParser(cache).parse_instance(url)
  File "C:\tmp\py-xbrl_orig\xbrl\instance.py", line 642, in parse_instance
    return parse_xbrl_url(url, self.cache)
  File "C:\tmp\py-xbrl_orig\xbrl\instance.py", line 277, in parse_xbrl_url
    return parse_xbrl(instance_path, cache, instance_url)
  File "C:\tmp\py-xbrl_orig\xbrl\instance.py", line 339, in parse_xbrl
    unit: AbstractUnit = unit_dir[fact_elem.attrib['unitRef']]
KeyError: 'Unit_sqft '
manusimidt commented 2 years ago

image

Strictly speaking, this would be an error of the creator of the report, since he is referencing a unit that has not been defined before ("Unit_sqft "). But since this error can be easily fixed in the parser, it makes sense to catch it.

mrx23dot commented 2 years ago

I will try to report it, but usually they say it works fine with existing parser, how do I dare to report something :D