ferru97 / PyPaperBot

PyPaperBot is a Python tool for downloading scientific papers using Google Scholar, Crossref, SciHub, and SciDB.
MIT License
410 stars 77 forks source link

Error 'Paper' object has no attribute 'sc_year' #6

Closed hskalin closed 4 years ago

hskalin commented 4 years ago

Hello and thanks for making this tool. So I encountered an error while trying to download a paper, here is the output

$ python -m PyPaperBot --query="Machine Learning" --scholar-pages=1 --min-year=2020 --dwn-dir="~/current"             
PyPaperBot is a Python tool for downloading scientific papers using Google Scholar, Crossref and SciHub.

Query: Machine Learning

Google Scholar page 1 : 5 papers found
Searching paper 1 of 5 on Crossref...
Searching paper 2 of 5 on Crossref...
Searching paper 3 of 5 on Crossref...
Searching paper 4 of 5 on Crossref...
Searching paper 5 of 5 on Crossref...
Papers found on Crossref: 4/5

Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/hskalin/.local/lib/python3.8/site-packages/PyPaperBot/__main__.py", line 122, in <module>
    main()
  File "/home/hskalin/.local/lib/python3.8/site-packages/PyPaperBot/__main__.py", line 118, in main
    start(args.query, args.scholar_pages, dwn_dir, args.min_year , max_dwn, max_dwn_type , args.journal_filter, args.restrict, DOIs)
  File "/home/hskalin/.local/lib/python3.8/site-packages/PyPaperBot/__main__.py", line 37, in start
    to_download = filter_min_date(to_download,min_date)  
  File "/home/hskalin/.local/lib/python3.8/site-packages/PyPaperBot/PapersFilters.py", line 50, in filter_min_date
    if paper.sc_year!=None and int(paper.sc_year)>=min_year:
AttributeError: 'Paper' object has no attribute 'sc_year' 

So what might be causing this?

ferru97 commented 4 years ago

Hi @hskalin, thanks for the report

It should be a trivial mistake, the name of that attribute should be year instad of sc_year By tonight I will release version v0.9.5.2 which fixes this bug

As soon as it will be released you can upgrade your version with pip install PyPaperBot --upgrade

ferru97 commented 4 years ago

v0.9.5.2 is out, let me know if you have problems