Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
1 task done
ssdv1 opened this issue Nov 27, 2024 · 1 comment
Labels

Comments

@ssdv1
Copy link

ssdv1 commented Nov 27, 2024

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.
@ssdv1 ssdv1 added the bug label Nov 27, 2024
@ssdv1
Copy link
Author

ssdv1 commented Nov 27, 2024

I made a pull request which solves this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant