Skip to content

Commit 4b5adb1

Browse files
committed
Verify file exists before opening, fixes #24
1 parent ba9327a commit 4b5adb1

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

minecraft_data/tools.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,10 @@ def commondata(_dir, edition = 'pc'):
5858
def _grabdata(_dir, datapaths):
5959
data = {}
6060
for category, folder in datapaths.items():
61-
with open(os.path.join(_dir, folder, f'{category}.json')) as fp:
62-
data[category] = json.load(fp)
61+
path = os.path.join(_dir, folder, f'{category}.json')
62+
if os.path.isfile(path):
63+
with open(path) as fp:
64+
data[category] = json.load(fp)
6365
return data
6466

6567

0 commit comments

Comments
 (0)