Skip to content

Commit

Permalink
Add better debugging for keyerrors
Browse files Browse the repository at this point in the history
  • Loading branch information
duckduckgrayduck authored Sep 26, 2023
1 parent 4140099 commit 0134dae
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,20 +190,17 @@ def set_doc_text(self, document, blobs_list):

pages.append(page)
except KeyError as e:
print("Key Error")
print(e)
self.set_message("Key error- ping us at info@documentcloud.org with the document you're trying to OCR")
sys.exit(1)
except ValueError:
self.set_message(
"Value error - Ping us at info@documentcloud.org"
" if you see this more than once."
)
sys.exit(1)

# Set the pages with text and position information to the document
# print(pages) debug
resp = self.client.patch(f"documents/{document.id}/", json={"pages": pages})
print(pages)
print(resp.status_code)
print(resp.json())

def vision_method(self, document, input_dir, filename):
"""Main method that calls the sub-methods to perform OCR on a doc"""
Expand Down

0 comments on commit 0134dae

Please sign in to comment.