0

I can run a python script by pressing the run python file button:

enter image description here

but unable to run the same when pressing the F5 key or run from the dropdown menu.

enter image description here

I can also run in the interactive window fine: enter image description here

And likewise i can run a notebook fine.

other checks:

I can verify that it doesn't debug by adding a breakpoint and running.

Would there be a key-binding that is missing perhaps ? What is causing this and how can one fix the issue please ?

13
  • What happens when you hit F5? My VSCode brings up a menu to let me choose an interpreter to use, then after I select it it runs the program in debug mode. Are you sure the F5 shortcut is configured in your VSCode? Commented Jul 8, 2022 at 17:35
  • it looks like it is running (somewhere), but there is no output in the terminal or debug console. I dont get any option to select an interpreter. Commented Jul 8, 2022 at 17:38
  • what do you mean it looks like it is running somewhere? is it just running in debug mode? where do you see it running? you probably don't get an option to select an interpreter because it is already configured for your current project. Commented Jul 8, 2022 at 17:39
  • when code is executed i see the stop / step-over / step-into / play box appear for a second, but then it goes... i can confirm that it does not execute the code (i checked this with time.sleep(20). Commented Jul 8, 2022 at 17:43
  • could be a problem with your interpreter, do ctrl + shift + p and type Python: Select Interpreter and ensure it's set to the correct path Commented Jul 8, 2022 at 17:48

1 Answer 1

0

It turns out that the error is a bug in the Python extension.

If you go to the Extensions tab, select the Python extension, then click on the little arrow next to Uninstall > Install Another Version... and install 2021.12.1559732655 the debugger should work again.

Here is the link to the fix: https://learn.microsoft.com/en-us/answers/questions/724858/vscode-debugger-not-working-for-python.html

In the meantime disable automatic updates to make it stick until they fix that.

To do this going to settings, typing python.terminal.activateEnvironment into the search bar and deactivating the checkbox.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.