Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: startfile setting when using ipython #1

Merged
merged 1 commit into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions autoroot/autoroot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@
# this line finds the absolute path of the original python script that is being run
startfile = os.path.abspath(sys.argv[0])

# if we are in notebook or pytest, just use current working directory
if startfile.endswith("ipykernel_launcher.py") or startfile.endswith("pytest"):
# if we are in notebook, pytest, or ipython, just use current working directory
if (
startfile.endswith("ipykernel_launcher.py")
or startfile.endswith("pytest")
or startfile.endswith("ipython")
):
startfile = os.getcwd()

# convert to Path object
Expand Down
8 changes: 6 additions & 2 deletions autorootcwd/autorootcwd/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@
# this line finds the absolute path of the original python script that is being run
startfile = os.path.abspath(sys.argv[0])

# if we are in notebook or pytest, just use current working directory
if startfile.endswith("ipykernel_launcher.py") or startfile.endswith("pytest"):
# if we are in notebook, pytest, or ipython, just use current working directory
if (
startfile.endswith("ipykernel_launcher.py")
or startfile.endswith("pytest")
or startfile.endswith("ipython")
):
startfile = os.getcwd()

# convert to Path object
Expand Down