Skip to content

Commit

Permalink
fix: check if file exists before upload
Browse files Browse the repository at this point in the history
  • Loading branch information
aoudiamoncef committed Jul 16, 2021
1 parent 31be3c2 commit 314f6e1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@


def upload(path, index):
with open(path) as f:
records = json.load(f)
index.save_objects(records, {'autoGenerateObjectIDIfNotExist': True})
if os.path.isfile(path):
with open(path) as f:
records = json.load(f)
index.save_objects(records, {'autoGenerateObjectIDIfNotExist': True})


upload("{}/{}/{}".format(github_workspace, index_file_directory, index_file_name), client.init_index(index_name))
Expand Down

0 comments on commit 314f6e1

Please sign in to comment.