MicheleCotrufo / pdf2doi

A python library/command-line tool to extract the DOI or other identifiers of a scientific paper from a pdf file.
101 stars 18 forks source link

AttributeError: 'function' object has no attribute 'config' #13

Closed alexmaehon closed 2 years ago

alexmaehon commented 2 years ago

AttributeError: 'function' object has no attribute 'config'

in google colab

MicheleCotrufo commented 2 years ago

Thanks for reporting this. Can you provide more info, like the full traceback, the commands you used, and which file you were analyzing? Which version of pdf2doi are you using?

alexmaehon commented 2 years ago

Version: 1.0.1

in python script: pdf2doi.config.set('verbose',False)

error: AttributeError Traceback (most recent call last) in () ----> 1 pdf2doi.config.set('verbose',False)

AttributeError: 'function' object has no attribute 'config'

alexmaehon commented 2 years ago

just tried Version: 1.1rc2

same problem

MicheleCotrufo commented 2 years ago

Thanks. I assume that you are importing the library with from pdf2doi import pdf2doi, as suggested in the examples. I just realized that this import does not work well with the last version of pdf2doi, because the name of the function pdf2doi.pdf2doi overlaps the name of the package pdf2doi You can fix it in two ways. Either do

import pdf2doi
pdf2doi.config.set('verbose',False)
doi = pdf2doi.pdf2doi(path)

or

from pdf2doi import pdf2doi, config
config.set('verbose',False)
doi = pdf2doi(path)

Both of them work, but I think the first one is more pythonic. I will fix the example in the readme file, thanks a lot for pointing this out!

alexmaehon commented 2 years ago

nice!