0

I used to use Pyzo for Python coding and decided to give VS Code a try because it is more feature-rich. I came across one huge annoyance, however. In Pyzo, I am used to code „interactively“ as Pyzo executes code in an interactive shell (https://pyzo.org/features.html).

I would like to replicate that in VS Code, but so far had no luck. With the Microsoft Python extension installed, the closest I can come is to select the whole code, right click and then click on „Run Selection/Line in Python Terminal“. For long scripts, however, this is very, very slow as it first prints each line to the terminal and then executes it line by line. Pyzo seems to operate silently.

Do you have a solution? I think, VS Code would be much faster if it did not print each line to the terminal first.

Best

Joey
  • 21
  • 2

2 Answers2

0

Use Code Runner(extension available in the marketplace of VS Code) or run a bash script in the terminal (python -u [name of the file])

Fatemeh Sangin
  • 558
  • 1
  • 4
  • 19
  • Thanks. I tried to run the code with Code Runner. It executes quickly in the "Output" tab of VS Code. But how can I then interact with the session, i.e. for example do something like: print(myvar) [with myvar having been defined by the script that was previously run] – Joey Nov 05 '22 at 10:42
0

I use Python Interactive window and find it very useful. It is not an immediate REPL but gives you the time to write a block of code and execute it with a key stroke.

At the bottom of the interactive pane you have a command line where you can type like a REPL. It is a temporary cell (multi line)

rioV8
  • 24,506
  • 3
  • 32
  • 49