From 10a2d680aff75da98290eea8579a30b0ca5b3f8d Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Mon, 3 Jun 2024 21:06:43 +0200 Subject: [PATCH] fix FileNotFoundError --- pyvckit/document_loader.py | 12 ++++++++---- setup.py | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/pyvckit/document_loader.py b/pyvckit/document_loader.py index 1710234..359c209 100644 --- a/pyvckit/document_loader.py +++ b/pyvckit/document_loader.py @@ -19,10 +19,14 @@ from pyld.jsonld import (JsonLdError, parse_link_header, LINK_HEADER_REL) def get_cache(): - with open("cache_context.json") as f: - doc_str = f.read() - if doc_str: - return json.loads(doc_str) + try: + with open("cache_context.json") as f: + doc_str = f.read() + if doc_str: + return json.loads(doc_str) + except FileNotFoundError: + pass + return {} diff --git a/setup.py b/setup.py index 34874a6..523ca49 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ test_requires = [ setup( name="pyvckit", - version="0.0.4", + version="0.0.6", packages=['pyvckit'], install_requires=[ "jsonref",