Skip to content

Commit 7db256f

Browse files
committed
Add working directory to sys.path when running through CLI
1 parent ba9a6d8 commit 7db256f

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
1515
- Fix day template to consider also the year of the challenge
1616
- Fix tests to include the year of the challenge
1717
- Fix `SmartSmartFileInputProvider` to use data directory relative to the working directory
18+
- Add working directory to sys.path when running through CLI
1819

1920
### Changed
2021
- Update repository to the newest cookiecutter template

src/aoc/main.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ def get_challenge_module_name(year: int, day: int) -> str:
5454

5555
def import_challenge_module(year, day: int):
5656
try:
57+
import sys
58+
59+
sys.path.insert(0, ".")
5760
module = importlib.import_module(get_challenge_module_name(year, day))
5861
except ModuleNotFoundError as e:
5962
echo(

0 commit comments

Comments
 (0)