Skip to content

Commit 4fa7f67

Browse files
chore: add "a+" to open for non-existing files
1 parent 030d5d8 commit 4fa7f67

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/adventofcode/scripts/add_day.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def create_module_dir(path: str) -> None:
5959
create_dir(path)
6060

6161
if not os.path.exists(init_file := os.path.join(path, "__init__.py")):
62-
with open(init_file):
62+
with open(init_file, "a+"):
6363
pass
6464

6565

@@ -82,12 +82,12 @@ def verify_input_exists(year: int, day: int) -> None:
8282
return
8383
except HTTPError as e:
8484
console.print("[red]Could not retrieve input data for " f"year {year} day {day} automatically: {e}")
85+
return
8586
except FileNotFoundError:
8687
console.print(
8788
"[red]Could not retrieve input data for " f"year {year} day {day}: .session not set correctly"
8889
)
89-
90-
raise ValueError(UNKNOWN_EXCEPTION)
90+
return
9191

9292

9393
def _read_solution_template(template_path: str, year: str, day: str) -> str:

0 commit comments

Comments
 (0)