titipata / pubmed_parser

:clipboard: A Python Parser for PubMed Open-Access XML Subset and MEDLINE XML Dataset
http://titipata.github.io/pubmed_parser/
MIT License
587 stars 168 forks source link

AttributeError: 'NoneType' object has no attribute 'getchildren' #151

Open qm-intel opened 3 months ago

qm-intel commented 3 months ago

What is the reason for causing this error?

Traceback (most recent call last):
  File "/home/user/myproject/1-parse-xml-image-caption-inline.py", line 137, in <module>
    caption_dict = pp.parse_pubmed_caption(xml_file_path)  # dict_keys(['pmid', 'pmc', 'fig_caption', 'fig_id', 'fig_label', 'graphic_ref'])
  File "/home/user/anaconda3/envs/medline/lib/python3.10/site-packages/pubmed_parser/pubmed_oa_parser.py", line 428, in parse_pubmed_caption
    fig_captions = fig.find("caption").getchildren()
AttributeError: 'NoneType' object has no attribute 'getchildren'
Michael-E-Rose commented 3 months ago

Can you please give the relevant code that leads you to experience this error?

The traceback alone isn't sufficient.