Skip to content

AttributeError: 'Paper' object has no attribute 'sc_cites' and AttributeError: 'Paper' object has no attribute 'sc_year' #45

Closed

Description

@Tolu1

Hi Vito, This is a neat tool you've got here, I came across this error when I tried to use --max-dwn-cites

Environment: Google Colab

Input:

!python -m PyPaperBot --query="Machine learning" --scholar-pages=1  --min-year=2018 --max-dwn-cites=10 --dwn-dir="\content\papers" --scihub-mirror="https://sci-hub.do"

Output:

PyPaperBot is a Python tool for downloading scientific papers using Google Scholar, Crossref and SciHub.
If you like this project, you can give me a cup of coffee at --> https://www.paypal.com/paypalme/ferru97 <-- :)

Query: Machine learning

Google Scholar page 1 : 10 papers found
Searching paper 1 of 9 on Crossref...
Searching paper 2 of 9 on Crossref...
Python 3
Searching paper 3 of 9 on Crossref...
Python 3
Searching paper 4 of 9 on Crossref...
Python 3
Searching paper 5 of 9 on Crossref...
Python 3
Searching paper 6 of 9 on Crossref...
Python 3
Searching paper 7 of 9 on Crossref...
Python 3
Python 3
Searching paper 8 of 9 on Crossref...
Python 3
Searching paper 9 of 9 on Crossref...
Python 3
Papers found on Crossref: 8/9

Traceback (most recent call last):
  File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/local/lib/python3.7/dist-packages/PyPaperBot/__main__.py", line 148, in <module>
    main()
  File "/usr/local/lib/python3.7/dist-packages/PyPaperBot/__main__.py", line 145, in main
    start(args.query, args.scholar_results, scholar_pages, dwn_dir, proxy, args.min_year , max_dwn, max_dwn_type , args.journal_filter, args.restrict, DOIs, args.scihub_mirror)
  File "/usr/local/lib/python3.7/dist-packages/PyPaperBot/__main__.py", line 43, in start
    to_download.sort(key=lambda x: int(x.sc_cites) if x.sc_cites!=None else 0, reverse=True)
  File "/usr/local/lib/python3.7/dist-packages/PyPaperBot/__main__.py", line 43, in <lambda>
    to_download.sort(key=lambda x: int(x.sc_cites) if x.sc_cites!=None else 0, reverse=True)
AttributeError: 'Paper' object has no attribute 'sc_cites'

Also when I tried to use --max-dwn-year

Input:

!python -m PyPaperBot --query="Machine learning" --scholar-pages=1  --min-year=2018 --max-dwn-year=10 --dwn-dir="\content\papers" --scihub-mirror="https://sci-hub.do"

Output:

PyPaperBot is a Python tool for downloading scientific papers using Google Scholar, Crossref and SciHub.
If you like this project, you can give me a cup of coffee at --> https://www.paypal.com/paypalme/ferru97 <-- :)

Query: Machine learning

Google Scholar page 1 : 10 papers found
Searching paper 1 of 9 on Crossref...
Searching paper 2 of 9 on Crossref...
Python 3
Searching paper 3 of 9 on Crossref...
Python 3
Searching paper 4 of 9 on Crossref...
Python 3
Searching paper 5 of 9 on Crossref...
Python 3
Searching paper 6 of 9 on Crossref...
Python 3
Searching paper 7 of 9 on Crossref...
Python 3
Python 3
Searching paper 8 of 9 on Crossref...
Python 3
Searching paper 9 of 9 on Crossref...
Python 3
Papers found on Crossref: 8/9

Traceback (most recent call last):
  File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/local/lib/python3.7/dist-packages/PyPaperBot/__main__.py", line 148, in <module>
    main()
  File "/usr/local/lib/python3.7/dist-packages/PyPaperBot/__main__.py", line 145, in main
    start(args.query, args.scholar_results, scholar_pages, dwn_dir, proxy, args.min_year , max_dwn, max_dwn_type , args.journal_filter, args.restrict, DOIs, args.scihub_mirror)
  File "/usr/local/lib/python3.7/dist-packages/PyPaperBot/__main__.py", line 40, in start
    to_download.sort(key=lambda x: int(x.sc_year) if x.sc_year!=None else 0, reverse=True)
  File "/usr/local/lib/python3.7/dist-packages/PyPaperBot/__main__.py", line 40, in <lambda>
    to_download.sort(key=lambda x: int(x.sc_year) if x.sc_year!=None else 0, reverse=True)
AttributeError: 'Paper' object has no attribute 'sc_year'

What's the reason for this🐺

Activity

  1. ferru97 commented on Nov 1, 2021

    @ferru97
    Owner

    Hi @Tolu1,

    First of all thank you for your interest in PyPaperBot!
    It's a silly naming error, I fix it in the day and release a new version.
    I keep you updated.

  2. ferru97 commented on Nov 1, 2021

    @ferru97
    Owner

    @Tolu1 now it should work, try it by downloading the new version v1.2.2

  3. Tolu1 commented on Nov 1, 2021

    @Tolu1
    Author

    Hi @ferru97 thanks for your quick response, it appears your fix has broken something, I have created a new issue for that here #46

  4. added a commit that references this issue on May 22, 2024
    4675985
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions