Skip to content
Open
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
6 changes: 6 additions & 0 deletions ipdb/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

__version__ = "0.13.14.dev0"

from shutil import which
from IPython import get_ipython
from IPython.core.debugger import BdbQuit_excepthook
from IPython.terminal.ipapp import TerminalIPythonApp
Expand Down Expand Up @@ -300,6 +301,11 @@ class Restart(Exception):
sys.exit(2)

mainpyfile = args[0] # Get script filename

# a executable command in $PATH may be passed
if not os.path.exists(mainpyfile):
mainpyfile = which(mainpyfile)

if not run_as_module and not os.path.exists(mainpyfile):
print("Error:", mainpyfile, "does not exist")
sys.exit(1)
Expand Down