MicheleCotrufo / pdf2bib

A python library/command-line tool to quickly and automatically generate BibTeX data starting from the pdf file of a scientific publication.
58 stars 7 forks source link

issue with metadata reference #6

Closed Don-Yin closed 2 months ago

Don-Yin commented 1 year ago
Traceback (most recent call last):
  File "/Users/donyin/mambaforge/bin/pdf2bib", line 8, in <module>
    sys.exit(main())
  File "/Users/donyin/mambaforge/lib/python3.10/site-packages/pdf2bib/main.py", line 303, in main
    results = pdf2bib(target=target)
  File "/Users/donyin/mambaforge/lib/python3.10/site-packages/pdf2bib/main.py", line 76, in pdf2bib
    result = pdf2bib(target=file)
  File "/Users/donyin/mambaforge/lib/python3.10/site-packages/pdf2bib/main.py", line 94, in pdf2bib
    result = pdf2bib_singlefile(filename)
  File "/Users/donyin/mambaforge/lib/python3.10/site-packages/pdf2bib/main.py", line 151, in pdf2bib_singlefile
    if metadata:  # if retrieval of bibtex data was succesful, we add the fields to the result dictionary
UnboundLocalError: local variable 'metadata' referenced before assignment

You have an issue with the variable metadata in your main script.

MicheleCotrufo commented 1 year ago

Thank you, I will give it a look asap. Can you send me the pdf file that generates this error?

Also, which version of the script you are using? It's possible that this error was already fixed in the version 1.1rc4, but I haven't had time to release an official version yet. Can you try to install pip install pdf2bib==1.1rc4 and check if error still occurs?

Don-Yin commented 1 year ago

Hi,

Thank you for your prompt reply and your suggestion. Sorry I was in a hurry so didn’t explain in much details.

Here you go, all PDFs. Still in a hurry.

I will give a closer look later asap.

Best, Don data.pdf emsemble.pdf error_map.pdf loss.pdf monai.pdf uncertainty.pdf unet.pdf

MicheleCotrufo commented 1 year ago

Thanks, please let me know also about the version you have.

Don-Yin commented 1 year ago

I used the default pip install, so it should be 1.0.3 as per https://pypi.org/project/pdf2bib/.

thanks.

MicheleCotrufo commented 1 year ago

Thanks. So, as I mentioned in my first post, I think this bug was already fixed in one of the last versions (1.1rc4) https://pypi.org/project/pdf2bib/1.1rc4/ but I hadn't had time yet to craft a final release of it. Can you try to upgrade to 1.1rc4 and check if that error still occurs?

boyanpenkov commented 1 year ago

Hello Michele, I also see the same, will test now with 1.1rc4...

boyanpenkov commented 1 year ago

@MicheleCotrufo confirming I no longer see this after pip install pdf2bib==1.1rc4

MicheleCotrufo commented 1 year ago

Great! Thanks! :)

henicosa commented 1 year ago

Hi :)

I had the same problem and

Thank you, I will give it a look asap. Can you send me the pdf file that generates this error?

Also, which version of the script you are using? It's possible that this error was already fixed in the version 1.1rc4, but I haven't had time to release an official version yet. Can you try to install pip install pdf2bib==1.1rc4 and check if error still occurs?

fixed it for me. Thanks.