Skip to content

Commit

Permalink
exist_ok=True
Browse files Browse the repository at this point in the history
  • Loading branch information
Reecepbcups committed Dec 14, 2023
1 parent d8d359d commit 2679e32
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions local-interchain/python/helpers/file_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Cache:
@staticmethod
def reset_contracts_cache_json():
if not os.path.exists(contracts_json_path):
os.makedirs(os.path.dirname(contracts_json_path))
os.makedirs(os.path.dirname(contracts_json_path), exist_ok=True)
with open(contracts_json_path, "w") as f:
f.write(json.dumps({"start_time": 0, "file_cache": {}}))

Expand All @@ -34,7 +34,7 @@ def get_chain_start_time_from_logs() -> int:
def get_cache_or_default(contracts: dict, ictest_chain_start: int) -> dict:
cache_time: str | int = 0
if os.path.exists(contracts_json_path):
os.makedirs(os.path.dirname(contracts_json_path))
os.makedirs(os.path.dirname(contracts_json_path), exist_ok=True)
with open(contracts_json_path, "r") as f:
c = dict(json.load(f))
cache_time = c.get("start_time", 0)
Expand Down
2 changes: 1 addition & 1 deletion local-interchain/python/util_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

# create contracts folder if not already
if not os.path.exists(contracts_path):
os.makedirs(contracts_path)
os.makedirs(contracts_path, exist_ok=True)

HOST = "127.0.0.1"
PORT = 8080
Expand Down

0 comments on commit 2679e32

Please sign in to comment.