MicheleCotrufo/pdf2doi

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

alexmaehon opened this issue · 5 comments

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

in google colab

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?

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'

just tried Version: 1.1rc2

same problem

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!

nice!