Skip to content

Interpreter crashes when given non-existent file in interactive mode #919

Description

@arian-deimling

See below. Running the same command with python3 versus bpython and py3 prints a short error message and then opens the interpreter, but bpy just crashes.

bpython % python3 -i file_that_does_not_exist.py
/Library/Developer/CommandLineTools/usr/bin/python3: can't open file 'file_that_does_not_exist.py': [Errno 2] No such file or directory
>>> ^D


bpython % bpython -i file_that_does_not_exist.py
Traceback (most recent call last):
  File "/Users/arian/Library/Python/3.8/bin/bpython", line 8, in <module>
    sys.exit(main())
  File "/Users/arian/Library/Python/3.8/lib/python/site-packages/bpython/curtsies.py", line 181, in main
    bpargs.exec_code(interp, exec_args)
  File "/Users/arian/Library/Python/3.8/lib/python/site-packages/bpython/args.py", line 161, in exec_code
    with open(args[0]) as sourcefile:
FileNotFoundError: [Errno 2] No such file or directory: 'file_that_does_not_exist.py'
bpython % 

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions