Skip to content

Commit be589c2

Browse files
committed
improve help if custom network exists
1 parent 3d14d18 commit be589c2

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/warnet/graph.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import os
22
import random
3+
import sys
34
from importlib.resources import files
45
from pathlib import Path
56

@@ -34,7 +35,13 @@ def custom_graph(
3435
fork_observer: bool,
3536
fork_obs_query_interval: int,
3637
):
37-
datadir.mkdir(parents=False, exist_ok=False)
38+
try:
39+
datadir.mkdir(parents=False, exist_ok=False)
40+
except FileExistsError as e:
41+
print(e)
42+
print("Exiting network builder without overwriting")
43+
sys.exit(1)
44+
3845
# Generate network.yaml
3946
nodes = []
4047
connections = set()

0 commit comments

Comments
 (0)