scholarly-python-package / scholarly

Retrieve author and publication information from Google Scholar in a friendly, Pythonic way without having to worry about CAPTCHAs!
https://scholarly.readthedocs.io/
The Unlicense
1.29k stars 292 forks source link

pprint doesn't work on Windows? #506

Open simon-20 opened 1 year ago

simon-20 commented 1 year ago

Describe the bug scholarly.pprint does not pretty print search results on Windows

To Reproduce I can reproduce in the following way:

from scholarly import scholarly search_query = scholarly.search_author('Marty Banks, Berkeley') item = next(search_query) item {'container_type': 'Author', 'filled': [], 'source': <AuthorSource.SEARCH_AUTHOR_SNIPPETS: 'SEARCH_AUTHOR_SNIPPETS'>, 'scholar_id': 'Smr99uEAAAAJ', 'url_picture': 'https://scholar.google.com/citations?view_op=medium_photo&user=Smr99uEAAAAJ', 'name': 'Martin Banks', 'affiliation': 'Professor of Vision Science, UC Berkeley', 'email_domain': '@berkeley.edu', 'interests': ['vision science', 'psychology', 'human factors', 'neuroscience'], 'citedby': 24392} scholarly.pprint(item) b"{'affiliation': 'Professor of Vision Science, UC Berkeley',\n 'citedby': 24392,\n 'email_domain': '@berkeley.edu',\n 'filled': False,\n 'interests': ['vision science', 'psychology', 'human factors', 'neuroscience'],\n 'name': 'Martin Banks',\n 'scholar_id': 'Smr99uEAAAAJ',\n 'source': 'SEARCH_AUTHOR_SNIPPETS',\n 'url_picture': 'https://scholar.google.com/citations?view_op=medium_photo&user=Smr99uEAAAAJ'}"

Expected behavior For the above, expected output: {'affiliation': 'Professor of Vision Science, UC Berkeley', 'citedby': 21074, 'email_domain': '@berkeley.edu', 'filled': False, 'interests': ['vision science', 'psychology', 'human factors', 'neuroscience'], 'name': 'Martin Banks', 'scholar_id': 'Smr99uEAAAAJ', 'source': 'SEARCH_AUTHOR_SNIPPETS', 'url_picture': 'https://scholar.google.com/citations?view_op=medium_photo&user=Smr99uEAAAAJ'}

This happens when running interactively with python, ipython, using either CMD or Powershell (5.1.19041.3031), as well as when running from my own program which imports scholarly.

Desktop (please complete the following information):

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

Additional context Add any other context about the problem here.

arunkannawadi commented 1 year ago

The encoding doesn't work the same way in Windows as it does in Linux and macOS. This is known from trying to run on Github Actions, but having no Windows environment to work on, I'd need some help from those who have to fix this issue.