Skip to content

scholarly.fill() doesnot completely fill author publication entry but it completely fills search publication search snippet. So I am not able to get bibtex citation with scholarly.bibtex() from author publication entry #556

@ssdv1

Description

@ssdv1

same issue already reported in discussion

To Reproduce

from scholarly import scholarly
search_query = scholarly.search_author('Brian Helenbrook')
brian = next(search_query)
author_brian=scholarly.fill(brian)
sample_pub=author_brian['publications'][1]
sample_pub_filled=scholarly.fill(sample_pub)
scholarly.bibtex(sample_pub_filled)

Gives this output

{
"name": "KeyError",
"message": "'ENTRYTYPE'",
"stack": "---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
Cell In[14], line 1
----> 1 scholarly.bibtex(sample_pub_filled)

File c:\Users\satya\anaconda3\Lib\site-packages\scholarly\_scholarly.py:250, in _Scholarly.bibtex(self, object)
248 if object['container_type'] == "Publication":
249 publication_parser = PublicationParser(self.__nav)
--> 250 return publication_parser.bibtex(object)
251 else:
252 self.logger.warning("Object not supported for bibtex exportation")

File c:\Users\satya\anaconda3\Lib\site-packages\scholarly\publication_parser.py:408, in PublicationParser.bibtex(self, publication)
406 # convert every key of the dictionary to string to be Bibtex compatible
407 a.entries = [str_dict]
--> 408 return bibtexparser.dumps(a)

File c:\Users\satya\anaconda3\Lib\site-packages\bibtexparser\init.py:85, in dumps(bib_database, writer)
83 if writer is None:
84 writer = bwriter.BibTexWriter()
---> 85 return writer.write(bib_database)

File c:\Users\satya\anaconda3\Lib\site-packages\bibtexparser\bwriter.py:139, in BibTexWriter.write(self, bib_database)
136 for content in self.contents:
137 try:
138 # Add each element set (entries, comments)
--> 139 bibtex += getattr(self, '_' + content + '_to_bibtex')(bib_database)
140 except AttributeError:
141 logger.warning("BibTeX item '{}' does not exist and will not be written. Valid items are {}."
142 .format(content, self._valid_contents))

File c:\Users\satya\anaconda3\Lib\site-packages\bibtexparser\bwriter.py:160, in BibTexWriter._entries_to_bibtex(self, bib_database)
156 elif type(self.align_values) == int:
157 # Use specified value
158 self._max_field_width = self.align_values
--> 160 return self.entry_separator.join(self._entry_to_bibtex(entry) for entry in entries)

File c:\Users\satya\anaconda3\Lib\site-packages\bibtexparser\bwriter.py:160, in (.0)
156 elif type(self.align_values) == int:
157 # Use specified value
158 self._max_field_width = self.align_values
--> 160 return self.entry_separator.join(self._entry_to_bibtex(entry) for entry in entries)

File c:\Users\satya\anaconda3\Lib\site-packages\bibtexparser\bwriter.py:165, in BibTexWriter._entry_to_bibtex(self, entry)
163 bibtex = ''
164 # Write BibTeX key
--> 165 bibtex += '@' + entry['ENTRYTYPE'] + '{' + entry['ID']
167 # create display_order of fields for this entry
168 # first those keys which are both in self.display_order and in entry.keys
169 display_order = [i for i in self.display_order if i in entry]

KeyError: 'ENTRYTYPE'"
}

Do you plan on contributing?
Your response below will clarify whether the maintainers can expect you to fix the bug you reported.

  • Yes, I will create a Pull Request with the bugfix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions