petermr / pygetpapers

a Python version of getpapers
Apache License 2.0
78 stars 9 forks source link

Errors running pygetpapers queries #40

Open EmanuelFaria opened 2 years ago

EmanuelFaria commented 2 years ago

@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):

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

petermr commented 2 years ago

Is this a Python 3.10 problem? Have you tested with it?

P.

On Thu, Jun 23, 2022 at 8:07 PM Emanuel Faria @.***> wrote:

Describe the bug Running a pygetpapers query returns unexpected errors:

To Reproduce

1. In terminal, run: % pygetpapers -q "(essential oil*)" -n

2. See errors Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.10/bin/pygetpapers", line 5, in from pygetpapers.pygetpapers import main File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pygetpapers/init.py", line 4, in 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 import requests File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/requests/init.py", line 60, in from . import utils File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/requests/utils.py", line 32, in 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 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.

— Reply to this email directly, view it on GitHub https://github.com/petermr/pygetpapers/issues/40, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFTCS5THN557BEYNLZZC2TVQSYV5ANCNFSM5ZVMEDGA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

-- Peter Murray-Rust Founder ContentMine.org and Reader Emeritus in Molecular Informatics Dept. Of Chemistry, University of Cambridge, CB2 1EW, UK

ayush4921 commented 2 years ago

@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 commented 2 years ago

@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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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