From a8ddd7bd5cce933ef8146cc31fc4cde2fb31bf1f Mon Sep 17 00:00:00 2001 From: khasmamad99 Date: Wed, 14 Feb 2024 08:07:36 -0500 Subject: [PATCH] fix startfile setting when using ipython --- autoroot/autoroot/__init__.py | 8 ++++++-- autorootcwd/autorootcwd/__init__.py | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/autoroot/autoroot/__init__.py b/autoroot/autoroot/__init__.py index dd77fb8..5b28be5 100644 --- a/autoroot/autoroot/__init__.py +++ b/autoroot/autoroot/__init__.py @@ -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 diff --git a/autorootcwd/autorootcwd/__init__.py b/autorootcwd/autorootcwd/__init__.py index 10e0990..6f5b778 100644 --- a/autorootcwd/autorootcwd/__init__.py +++ b/autorootcwd/autorootcwd/__init__.py @@ -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