Skip to content

Commit 734bd7b

Browse files
committed
feat: added json creation in main()
1 parent 2a4f969 commit 734bd7b

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

bin/Eukfinder.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2622,11 +2622,8 @@ def update_json(new_json_data):
26222622

26232623
def read_json():
26242624

2625-
try:
2626-
with open(_json_path, "r") as json_file:
2627-
json_data = json.load(json_file)
2628-
except FileNotFoundError: # TODO: should create this if not found
2629-
sys.exit(f"config.json cannot be found at {_json_path}. \nExiting...")
2625+
with open(_json_path, "r") as json_file:
2626+
json_data = json.load(json_file)
26302627

26312628
return json_data
26322629

@@ -2820,6 +2817,21 @@ def parse_arguments(json_data):
28202817
return parser.parse_args()
28212818

28222819
def main():
2820+
# json creation
2821+
if not os.path.exists(_json_path):
2822+
os.makedirs("~/.eukfinder", exist_ok=True)
2823+
2824+
with open(_json_path, "w"):
2825+
pass
2826+
2827+
update_json(
2828+
{
2829+
"Centrifuge": "",
2830+
"plast_db": "",
2831+
"plast_map": ""
2832+
}
2833+
)
2834+
28232835
json_data = read_json()
28242836
args = parse_arguments(json_data)
28252837

0 commit comments

Comments
 (0)