Skip to content

Commit 2869808

Browse files
committed
Adds parent path creation for debug log.
1 parent 49b8384 commit 2869808

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

bittensor_cli/cli.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,12 @@ def debug_callback(value: bool):
612612
"Enter the file location to save the debug log for the previous command.",
613613
default="~/.bittensor/debug-export",
614614
).strip()
615-
save_file_loc = os.path.expanduser(save_file_loc_)
615+
save_file_loc = Path(os.path.expanduser(save_file_loc_))
616+
if not save_file_loc.parent.exists():
617+
if Confirm.ask(
618+
f"The directory '{save_file_loc.parent}' does not exist. Would you like to create it?"
619+
):
620+
save_file_loc.parent.mkdir(parents=True, exist_ok=True)
616621
try:
617622
with (
618623
open(save_file_loc, "w+") as save_file,

0 commit comments

Comments
 (0)