Skip to content

Commit

Permalink
Fix to support new .json extension in candy machine cache file
Browse files Browse the repository at this point in the history
  • Loading branch information
0xEnrico committed Jan 3, 2022
1 parent d186b98 commit 3acbd91
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions arweave_nft_uploader/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,14 @@ def main():

# Load cache file
cache_filename = ""
try:
cache_filename = os.path.join('.cache', args.env + "-" + args.cache_name)
with open(cache_filename, 'r') as f:
cache_data = json.load(f)
except Exception as ex:
cache_data = {}
for cache_extension in ["", ".json"]:
try:
cache_filename = os.path.join('.cache', args.env + "-" + args.cache_name + cache_extension)
with open(cache_filename, 'r') as f:
cache_data = json.load(f)
break
except Exception as ex:
cache_data = {}
if "program" not in cache_data or "items" not in cache_data or "0" not in cache_data["items"]:
logging.error("")
logging.error("Cache file " + str(cache_filename) + " is not initialized with a candy machine program")
Expand Down

0 comments on commit 3acbd91

Please sign in to comment.