2

Currently running Windows 10, python version 3.8.5 in Visual Studio Code.

Every time I attempt to execute any program using vpython the program works fine, but permanently locks up my integrated terminal so that it cannot be used anymore. It still displays the old text from previous runs but will not accept any new program executions or allow anything to be typed into the terminal. All other programs I have tried work just fine, but any program that uses vpython freezes it. The same vpython programs work just fine in IDLE. I have made sure that I have "Run this program in compatibility mode for" unchecked already.

MWE

from vpython import *

ball = sphere(pos=vector(-5, 0, 0), radius=0.5, color=color.cyan)
Niko Föhr
  • 28,336
  • 10
  • 93
  • 96
Dan
  • 21
  • 1
  • 2

3 Answers3

4

It's a bug in vpython, of which I have made an issue. It is not specific to VSCode Terminal, but also affects vpython scripts launched with cmd or Powershell.

Note that it does not actually freeze the terminal for infinity. In my tests it took sometimes ~1 minute, sometimes up to 10 minutes for the program to return to the command line.

Workarounds

a. Launch another terminal / cmd / powershell tab or window and use it.

b. Close all tabs of the browser. Killing the process of the browser will return immediately.

c. Wait patiently until the program returns. (1-10 minutes)

Or, clone the vpython repo and find and fix the bug yourself ;-)

Niko Föhr
  • 28,336
  • 10
  • 93
  • 96
1

I'm pretty sure I had this problem before, you've written some code that keeps running, which prevents vs code from running it again. It's not frozen, it's just continuously running your code. you can stop code execution by using one of the following methods.

  1. use shortcut Ctrl + Alt + M.
  1. press F1 and then select/type Stop Code Run.
  1. right click the Output Channel and then click Stop Code Run in context menu.
0

In VSCode, because the program is still executing, the default execution terminal "Python" of VSCode is occupied. The code will run in this terminal one by one, but it does not support synchronous operation to avoid confusion during execution.

Here is a workaround to help you execute other scripts:

Please click "Terminal" in VSCode, select "New Terminal", and then manually enter the execution command, for example: "d:/.../test09/.venv02/Scripts/python.exe d:/.../.test09/Ze/b.py"

In this way, we can execute other programs on the terminal (another terminal) without causing confusion and congestion.

Jill Cheng
  • 9,179
  • 1
  • 20
  • 25