How do I add Multiple Python Interactive Windows in VS Code? - python

I am trying to create a second Ipython window in my VS Code Environment.

Sorry to say, but currently there can only be one Interactive Window open at a time. We do have an issue filed on allowing multiple windows here:
https://github.com/Microsoft/vscode-python/issues/3104
Which you can upvote or comment on if you would like.

The response above is longer up-to-date. Now, VS code supports multiple interactive windows: Open settings and search "interactive window mode".
You can select from single, multiple, per-file
see https://visualstudiomagazine.com/articles/2020/08/13/vs-code-python.aspx
To create another interactive window go to command pallete (Ctrl+Shift+p) and search for "Create Interactive Window."

Related

Visual Studio Code - Python interactive data science REPL with autocomplete

Since VS Code supports JupyterNotebooks natively with the Python extension (https://code.visualstudio.com/docs/python/jupyter-support) I like to launch the notebooks and see the outputs directly in VS Code.
The only issue I'm having with this is that the Python Interactive window is not that interactive, it just works to show the output of the cells.
Is there any way to allow autocomplete functionality in that console? Something more like an IPython console where I can hit Tab and see all the available options.
The answer is that this currently does not exist. The input box on the Interactive Windows is basically just a plain text input terminal (with colorization) currently. We do have a work item to track adding autocomplete here. If you want to watch or upvote that item it's located here:
https://github.com/Microsoft/vscode-python/issues/4170

Is it possible to split the output console in PyCharm?

Is it possible to have multiple python consoles side to side or as independent windows in PyCharm?
Note: I am already using Windowed Mode to have the console panel as a window, but I want to have separate consoles on separate windows.
I am using PyCharm Professional 2018.1
I open a Python console via View -> Tool Windows -> Python console. Clicking on the green "plus" symbol I can open multiple consoles, but they are showed as different tabs.
What I would like it being able to see the "content" of multiple console at the same time, hence having them side to side or as independent windows I can arrange as I want.
How can I achieve this?
Unfortunately, splitting console is still a feature in request right now for Pycharm 2018.2.3 as mentioned in this question.

How to run same application in new run tool window? Pycharm Community 2017

I am working on a Python 3.6 project in Pycharm Community Edition 2017.2.3.
I have multiple run configurations in my project. Each different run configuration will open a different 'Run tool window'.
I want to look through the output of the previous run of my application while re-running it in another tool window. However, each new run of the same configuration will overwrite the console output of the previous run. How do I run the same application/configuration in a new tool window?
It's probably possible to just duplicate the configuration, but I'm looking for a better way. Maybe something similar to opening new terminals?
Go to build configurations and enable show command line afterwards.
It simply opens the python interpreter in the console after running your code.
Now When you run the code again. It will open a new tab in the run window, instead of overwriting the old one.
You can pin first tab by right click then run another script
I do not think if it is possible. But you can do it using terminal.
It's still in Run/Debug configurations but now it's called, "Run with Python console".

Command window in Pycharm

Is there a interface in Pycharm where we can simply type in some commands and run it ?
Something like in Matlab, we can type in "a = 1; b = 2; c = a+b" then we get ans=3.
Thanks
PS: we know we can create a python file in Pycharm and run it, e.g., "a = 1; b = 2; c = a+b; print(c)" but it is not as convenient as a command window.
Short answer from the docs:
To launch an interactive console
On the main menu, choose Tools | Run Python console.
Description:
REPL console
PyCharm also helps those who love the full control of an
interactive console: on the Tools menu, you can find commands that
launch the interactive Python or Django consoles. Here you can type
commands and execute them immediately. Moreover, PyCharm's interactive
consoles feature syntax highlighting, code completion, and allow
viewing the history of commands (Ctrl+Alt+E or Up/Down arrows while in
the editor).
PyCharm also makes it possible to run in console source code from the
editor — just make your selection, and then press Shift+Alt+E (Execute
selection in console on the context menu of the selection).
Independent of Pycharm, you can also access the REPL in the terminal (or cmd shell on Windows) by typing
python
at the prompt.
In PyCharm, you navigate to the View -> Tool Windows menu and toggle the Terminal window See image here. It will likely show up at the bottom of your IDE window.
Another very good (and more general option) is to use IDLE. From its Wikipedia entry...
IDLE is intended to be a simple IDE and suitable for beginners, especially in an educational environment. To that end, it is cross-platform, and avoids feature clutter.
It ships with basically every standard version of Python since 1.5.2 so I'm pretty sure you have it available on your system (I've checked with Linux and Mac OS X).
To fire up IDLE in Python2, enter: /path/to/python/bin/idle where /path/to/python/bin is where you find the Python executable.
For Python3, use idle3 instead.
You should see a new separate terminal window open up (with syntax highlighting and all!)See image here.
Find the attached screenshot..
You can observe the o/p of the editor in Run window.
You can also find Python Console and Command Terminal at the bottom of the Pycharm.

Interactive console using Pydev in Eclipse?

I'm debugging my Python code in Eclipse using the Pydev plugin. I'm able to open a Pydev console and it gives me two options: "Console for currently active editor" and "Python console". However none of them is useful to inspect current variable status after a breakpoint.
For example, the code stopped at a breakpoint and I want to inspect an "action" variable using the console. However my variables are not available. How can I do things like "dir(action)", etc? (even if it is not using a console).
This feature is documented here:
http://pydev.org/manual_adv_debug_console.html
The console that opens in the debug perspective is in fact interactive, although it took me a while to realize it. You need to hit return twice after typing something and then it gets evaluated.
More info on the Pydev site here: http://pydev.org/manual_adv_debug_console.html
Double click on "action" or any other variable.
ctrl+shift+D
And if you're using watches, I cant imagine better interaction. You are able to see every change.
When I set a break point and hit F11 Eclipse launches the debugger and prompts to open the "Debug Perspective". You can then open the Window-->Show View --> Expressions which opens the expressions view, you can then right click in the Expressions view windows and choose "Add Watch Expression" to add any expression(such as dir)
Conversely I was also able to type in dir(some expression) in the PyDev console and get the same effect.
I'm using PyDev 1.4.6.2788
On a small monitor, you may not realize that the debug interactive console is different from the regular interactive console: it has a second command prompt at the bottom where you type, not at the top like the normal console.

Categories