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

Errors running pygetpapers queries #40

Open
EmanuelFaria opened this issue Jun 23, 2022 · 6 comments
Open

Errors running pygetpapers queries #40

EmanuelFaria opened this issue Jun 23, 2022 · 6 comments

Comments

@EmanuelFaria
Copy link

EmanuelFaria commented Jun 23, 2022

@petermr @ayush4921
Describe the bug
Running apygetpapers query returns unexpected errors below.
NOTE: running pygetpapers -h or pygetpapers --help returns the same errors

To Reproduce

1. In terminal, run:
% pygetpapers -q "phytomedicine" -n

2. See errors

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.10/bin/pygetpapers", line 5, in <module>
    from pygetpapers.pygetpapers import main
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pygetpapers/__init__.py", line 4, in <module>
    from pygetpapers.download_tools import DownloadTools
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pygetpapers/download_tools.py", line 14, in <module>
    import requests
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/requests/__init__.py", line 60, in <module>
    from . import utils
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/requests/utils.py", line 32, in <module>
    from .cookies import cookiejar_from_dict
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/requests/cookies.py", line 172, in <module>
    class RequestsCookieJar(cookielib.CookieJar, collections.MutableMapping):
AttributeError: module 'collections' has no attribute 'MutableMapping'

Expected behavior
Query should return the number of articles available on EUPMC that satisfy the query.

Desktop (please complete the following information):

  • OS: MacOS

Additional context
pygetpapers seems to be installed properly. No errors present when re-installing pygetpapers.

@petermr
Copy link
Owner

petermr commented Jun 23, 2022 via email

@ayush4921
Copy link
Collaborator

@Mannyrules It doesn't seem like a python or pygetpapers problem to me. I tried running pygetpapers right now and it works for me. Maybe, try installing it in a virtual environment and see if the problem persists. In my opinion, the issue lies in some other libraries you have installed that have the same names as the python libraries used by libraries that pygetpapers depends on.

@EmanuelFaria
Copy link
Author

@ayush4921 I've tried running the virtual environment, following he steps in the docanalysis readme, but when I get to the step to activate venv\Scripts\activate.bat it returns: zsh: command not found: venvScriptsactivate.bat

When I look in the venv directory, that file is not there. I think my machine is haunted by an evil spirit

@EmanuelFaria
Copy link
Author

Neither pygetpapers or getpapers is respecting the query parameters. Is it because the programs aren't updated to work with the current version of EUPMC's API?

Paste this into europmc and compare the download results in either program

("essential oil" OR "essential oils" OR plant* OR phyto* OR botan*) AND (TABLE:"chemical composition" OR TABLE:"chemical analysis" OR TABLE:"chemical constituents" OR TABLE:"chemical components" OR TABLE:"chemical compounds" OR TABLE:phytochemical OR  TABLE:"chemical profile" OR TABLE:volatile) AND (TABLE:"essential oil" OR TABLE:"essential oils" OR TABLE:plant* OR TABLE:phytomed* OR TABLE:botan* OR TABLE:*phenol* OR TABLE:phytochem* OR TABLE:plant* OR TABLE:*terpen*) NOT (*fish NOT feed* NOT additive* NOT antibody NOT antigen NOT beef NOT broiler* NOT cancer NOT cattle NOT crop* NOT cross-link* NOT hens NOT HIV NOT livestock NOT nemati* NOT phytogeograph* NOT phytoglobin* NOT phytoh* NOT veterinar* NOT igneous NOT ocean* NOT *water* NOT pollution NOT "COVID-19" NOT corona* NOT pandemic NOT lockdown NOT economic*)

@EmanuelFaria
Copy link
Author

SOLVED!!

It turns out that because I am searching for terms with two-word that are surrounded by double quotes, I have to use a single quote at the beginning and end of the query!

Bad: pygetpapers -q "("essential oil" AND "essential oils"..)"
Good: pygetpapers -q '("essential oil" AND "essential oils"..)'

@EmanuelFaria
Copy link
Author

Perhaps pygetpapers should only allow (or, in the instructions, advise to use) the single-quote in the query rather than give people the option? If so, change the examples in the readme and any other instructions in the wiki

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

No branches or pull requests

3 participants