Skip to content

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

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🐺

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions