user3150201
user3150201

Reputation: 1947

How can I receive error messages from the Python interpreter?

I write Python code in Notepad++, save it to a .py file and than run it by double clicking on the file in Windows.

However if there are any syntax errors in the file, the program simply shuts down. I get no error message.

How can I receive error messages regarding problems in the program? Also, what's the best way to code an run Python scripts?

Upvotes: 0

Views: 347

Answers (1)

poke
poke

Reputation: 388313

When double-clicking a .py file in Windows, the standard program handler will be launched to execute that file. This will be the Python interpreter, which runs in a console window. As soon as the process finished—successful or not—the window closes again, which doesn’t allow you to see the error messages.

In order to keep it around, run your program from within the command line, e.g. by opening cmd.exe first and executing the file there. That way, even when the Python process exists, the output will be still visible.

Upvotes: 1

Related Questions