Skip to content

Commit 6a15a43

Browse files
committed
Close the stats JSON file when done reading for less "unclosed file" warnings
1 parent fda16c7 commit 6a15a43

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

webpack_loader/utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ def get_config(config_name):
4545

4646
def get_assets(config):
4747
try:
48-
return json.loads(open(config['STATS_FILE']).read())
48+
with open(config['STATS_FILE']) as f:
49+
return json.load(f)
4950
except IOError:
5051
raise IOError(
5152
'Error reading {}. Are you sure webpack has generated the file '

0 commit comments

Comments
 (0)