2

In PyCharm, there's a handy button next to if __name__... statements that runs a script,

enter image description here

with configurations for the run in a run configurations menu.

One of the options is to "Run with Python Console":

enter image description here

This is really handy, because I can run my in-progress script in the console without ponderously highlighting and ctrl-entering. I'm then in the console, with everything I just did in memory, and I can go and continue writing my code using the REPL to check how things are working along the way.

In VScode, when I hit the run button

enter image description here

It just runs the script from the terminal. I can see any output that it prints, but it doesn't drop me into a REPL interface like I'm accustomed with PyCharm.

Is this sort of functionality attainable with VSCode?

2 Answers 2

2

VSCode without this functionality, but it has some similar functionalities:

  1. Ctrl+A -> rightclick -> Run Selection/Line in Python Terminal.
  2. rightclick -> Run Current File in Interactive Window
Sign up to request clarification or add additional context in comments.

Comments

2

I've been looking for exactly the same functionality. Following two other stackoverflow posts you can get the desired behaivor -> executing in an REPL ipython terminal (original links at the end of the post):

edit the terminal launchArgs in settings.json (Preference: Open Settings JSON; or Preference -> Settings -> Search launchArgs -> edit in json):

"python.terminal.launchArgs": [
   "-i",       
   "-m",
   "IPython",
   "--no-autoindent",
]

Reference Links:

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.