Python Forum
vs code interpreter vs IDLE feature
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
vs code interpreter vs IDLE feature
#1
I have been using IDLE for quite a while now. I don't really know it super well, but it's pretty basic.

Recently, because VS Code is featured in so many tutorials, and so many tutorials need a feature that's not in IDLE, like a .dot file viewer, that I've switched to trying to learn how to use VSCODE.

HOwever, when I used to follow tutorials, I would sometimes use the variables and functions still loaded to the interpreter memory after the file finished , meaning I could play with the lists from a file etc. ,,, I don't know how to achieve this is VS CODE. so far, I can only see how I can either run a file, or run the interpreter from the terminal. I also don't know how to run files from inside the interpreter, which MIGHT be the solution I'm looking for, and after looking it up once or twice haven't had any success.

Is there a goto solution for this feature??
Reply
#2
One way of achieving desired result is to run Python file in interactive mode in terminal.

python -i my_code.py


This has nothing to do with VS Code. It runs file and after that keeps session “alive”, so that names and functions are accessible.
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy

Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Reply
#3
(Mar-02-2019, 04:31 AM)tsmspace Wrote: Is there a goto solution for this feature??
Yes,what i use is cmder in VS Code or alone with ptpython or IPython.
Seamless VS Code Integration cmder
[Image: jGOt46.jpg]
[Image: Sl3qbO.jpg]

As mention can use -i i do use python,but eg ptpython -i my_code.py to get autocomplete and help.
Look at VS Code from start | Python environment Windows.
Reply
#4
You may also have a look into "Run code selection in the Python Interactive window" feature available in February 2019 release of the Python Extension for Visual Studio Code (description is at the very end of linked article).
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy

Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Reply
#5
(Mar-02-2019, 04:31 AM)tsmspace Wrote: I have been using IDLE for quite a while now. I don't really know it super well, but it's pretty basic.

Recently, because VS Code is featured in so many tutorials, and so many tutorials need a feature that's not in IDLE, like a .dot file viewer, that I've switched to trying to learn how to use VSCODE.

HOwever, when I used to follow tutorials, I would sometimes use the variables and functions still loaded to the interpreter memory after the file finished , meaning I could play with the lists from a file etc. ,,, I don't know how to achieve this is VS CODE. so far, I can only see how I can either run a file, or run the interpreter from the terminal. I also don't know how to run files from inside the interpreter, which MIGHT be the solution I'm looking for, and after looking it up once or twice haven't had any success.

Is there a goto solution for this feature??

add -i option/argument in python terminal.

Steps-
1. Open settings.json file using command palette(ctrl+shift+p).
2. Add "python.terminal.launchArgs": ["-i"] , with all the quotes.
3. Save and run file as usual.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Why can I not see the code correctly in Python IDLE.? Trump 8 653 Apr-04-2024, 07:47 AM
Last Post: jonesphedra
  add mqtt feature to existing code Positron79 0 587 Jan-31-2023, 05:56 PM
Last Post: Positron79
Photo Visual studio code unable to color syntax on python interpreter tomtom 4 6,844 Mar-02-2022, 01:23 AM
Last Post: tomtom
  Question re: running code in Editor (i.e. Atom) vs Python interpreter rok 3 2,411 Jun-29-2020, 09:20 PM
Last Post: bowlofred
  Using IDLE, bug when clicking code StarBasket 4 2,466 Jul-31-2019, 12:30 PM
Last Post: Malt
  Code works in IDLE, appears to work in CMD, but won't produce files in CMD/Windows ChrisPy33 3 3,228 Jun-12-2019, 05:56 AM
Last Post: ChrisPy33
  How to write a code to get this kind of output in IDLE kavindu 5 3,542 Oct-28-2018, 07:46 PM
Last Post: wavic
  IDLE not importing pygame (ok outside of IDLE) miner_tom 1 3,314 Sep-14-2018, 07:54 PM
Last Post: Larz60+
  Python IDLE 3.6.2 on WIn7 vs Pyhton 3 IDLE raspberry djdan_23 5 5,707 Sep-07-2017, 12:51 PM
Last Post: Larz60+
  Error while writing a code for feature scaling prateek 1 2,507 Aug-15-2017, 09:17 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020