Skip to content

Commit ae526fb

Browse files
committed
feat: support executables passed to ipdb3
For instance, if your project has a script section a bin/ entry in your venv will be generated. It's helpful to be able to pass the command reference to ipdb for debugging.
1 parent 400e37c commit ae526fb

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

ipdb/__main__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
__version__ = "0.13.14.dev0"
1414

15+
from shutil import which
1516
from IPython import get_ipython
1617
from IPython.core.debugger import BdbQuit_excepthook
1718
from IPython.terminal.ipapp import TerminalIPythonApp
@@ -300,6 +301,11 @@ class Restart(Exception):
300301
sys.exit(2)
301302

302303
mainpyfile = args[0] # Get script filename
304+
305+
# a executable command in $PATH may be passed
306+
if not os.path.exists(mainpyfile):
307+
mainpyfile = which(mainpyfile)
308+
303309
if not run_as_module and not os.path.exists(mainpyfile):
304310
print("Error:", mainpyfile, "does not exist")
305311
sys.exit(1)

0 commit comments

Comments
 (0)