Skip to content

Commit

Permalink
Merge pull request #25 from Mkranj/error_reporting
Browse files Browse the repository at this point in the history
Print error when failing to read file
  • Loading branch information
Mkranj authored Feb 12, 2023
2 parents ea1d3a3 + 47fb5f0 commit 1da9ef0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion PapersCited.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ def read_document(filename):

try:
target_document = textract.process(filename, output_encoding="utf-8-sig")
except:
except Exception as e:
# If the file exists, but cannot be read, an error will be raised.
print(
f"The file {filename} couldn't be read. Make sure the file is a valid textual file.")
Expand All @@ -295,6 +295,8 @@ def read_document(filename):
print("poppler for .pdf")
print("\nPlease check 'help_with_libraries.txt' at PapersCited Github:")
print("https://github.com/Mkranj/PapersCited/blob/main/help_with_libraries.txt")
print("\nThe error message:\n")
print(e)
input("\nPress Enter to exit the program.")
sys.exit()

Expand Down

0 comments on commit 1da9ef0

Please sign in to comment.