scholarly icon indicating copy to clipboard operation
scholarly copied to clipboard

pprint doesn't work on Windows?

Open simon-20 opened this issue 2 years ago • 1 comments

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

To Reproduce I can reproduce in the following way:

  • create new python virtual environment
  • install scholarly
  • activate venv
  • run python, then:
>>> from scholarly import scholarly >>> search_query = scholarly.search_author('Marty Banks, Berkeley') >>> item = next(search_query) >>> item {'container_type': 'Author', 'filled': [], 'source': , '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):

  • python version: Python 3.11.3
  • OS: Windows 10

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

  • [ ] Possibly.

Additional context Add any other context about the problem here.

simon-20 avatar Jun 16 '23 09:06 simon-20

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.

arunkannawadi avatar Jun 17 '23 22:06 arunkannawadi