Skip to content

Commit

Permalink
Close json files after reading values
Browse files Browse the repository at this point in the history
This prevents directory renames/deletes from hanging on Windows due to
the file handle still being open
  • Loading branch information
Slashbunny committed Nov 27, 2019
1 parent a09910b commit 395d815
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions download.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ def fix_plugin_directories(dest):
platform = data['platform']
guid = data['guid']

# Close json file
m.close()

expected_dir = platform + '_' + guid
expected_path = os.path.join(dest, expected_dir)

Expand Down Expand Up @@ -176,6 +179,9 @@ def download_plugins(data, dest):
data = json.load(m)
existing_version = data['version']

# Close json file
m.close()

# Version already matches
if version == existing_version:
print('NOTICE: Skipping "{}" download, "{}" already exists'
Expand Down

0 comments on commit 395d815

Please sign in to comment.