chakki-works / xbrr

eXtensible Business Report Reader
MIT License
32 stars 4 forks source link

Could not get business.management_analysis #4

Closed peisuke closed 4 years ago

peisuke commented 4 years ago

When I get business.management_analysis, this error occurred.

import os
import xbrr

os.makedirs('output', exist_ok=True)
xbrr.edinet.api.document.get_xbrl('S100EZLO', save_dir='./output', expand_level="dir")

xbrl = xbrr.edinet.reader.read(os.path.join('output', 'S100EZLO'))
business = xbrl.extract(xbrr.edinet.aspects.Business)
print(business.management_analysis.value)

The error is show below.

Traceback (most recent call last):
  File "check.py", line 10, in <module>
    print(business.management_analysis.value)
  File "/usr/local/lib/python3.7/site-packages/xbrr-0.2.3.dev1+gdcb3294-py3.7.egg/xbrr/edinet/reader/aspects/business.py", line 29, in management_analysis
    return self.get_text_value("management_analysis")
  File "/usr/local/lib/python3.7/site-packages/xbrr-0.2.3.dev1+gdcb3294-py3.7.egg/xbrr/base/reader/base_parser.py", line 42, in get_text_value
    self.reader, element)
  File "/usr/local/lib/python3.7/site-packages/xbrr-0.2.3.dev1+gdcb3294-py3.7.egg/xbrr/edinet/reader/element_value.py", line 45, in create_from_element
    .label(label_kind, label_verbose)
  File "/usr/local/lib/python3.7/site-packages/xbrr-0.2.3.dev1+gdcb3294-py3.7.egg/xbrr/edinet/reader/element.py", line 44, in label
    return label.text
AttributeError: 'NoneType' object has no attribute 'text'
peisuke commented 4 years ago

Solved.

import os
import xbrr

document_id = 'S100EZLO'
os.makedirs('output', exist_ok=True)
#xbrr.edinet.api.document.get_xbrl(document_id, save_dir='./output', expand_level="dir")
xbrr.edinet.api.document.get_xbrl(document_id, save_dir='./output')

#xbrl = xbrr.edinet.reader.read(os.path.join('output', document_id))
xbrl = xbrr.edinet.reader.read("output/{}_1.xbrl".format(document_id))
business = xbrl.extract(xbrr.edinet.aspects.Business)
print(business.management_analysis.value)