Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File not closed #17

Closed
DuzaBF opened this issue Jun 15, 2022 · 1 comment
Closed

File not closed #17

DuzaBF opened this issue Jun 15, 2022 · 1 comment

Comments

@DuzaBF
Copy link
Contributor

DuzaBF commented Jun 15, 2022

Hi,

The function pdf2doi_singlefile does not close the opened pdf file. The close file statement is not executed due to return statements on successful identifier finding.

pdf2doi/pdf2doi/main.py

Lines 161 to 165 in d8e7117

if result['identifier']:
return result
if flag_closefile:
file.close()

This causes the issue with pdf-rename on Windows. The renaming attempt results in access error as file is opened by the script itself.

I'll make PR shortly to fix this.

@MicheleCotrufo
Copy link
Owner

I merged the contribution from DuzaBF, and made some additional changes to the code to make sure that a result dictionary with the key 'identifier' is always returned. This should fix this bug.
Please download the version 1.3 of pdf2doi :) I will also add the requirement in the requirements.txt of pdfrenamer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants