I am just now getting started with Sublime Text 3 and SublimeREPL for Python usage and I am beginning to enjoy it. I am trying to configure my space to be as efficient for me as possible. So far I have configured my SublimeREPL to reuse the tab when running code, namely:
Adding:
"view_id": "*REPL* [python]",
in the "repl_python_run" command in SublimeREPL\config\Python\Main.sublime-menu,
and then to changing:
if view.name() == view_id:
found = view
window.focus_view(found) # <-- add this line
break
in SublimeREPL\sublimerepl.py.
As a result, I am able to reuse the same tab after a build. I am looking for two possible enhancements to my space:
1) If i disattach the tab that runs python in interactive code and build again, it creates a new tab. How can I have it so that when I build, interactive mode launches in a new window and I can reuse that window everytime I build?
2) How can I have the bottom of my Sublime Text have an interactive output, similar to RStudio? This way I can see the results of each build in the same window, and make modifications as necessary without switching tabs/opening new windows.
Any help would be appreciated!
Related
So recently my PyCharm is missing its run tool window that usually show the run/debug results. it is now replaced with python console and services, which is really frustrating because It's just showing gibberish and command-prompt-like format.
How do I return the run tool window back as my main run/debug window?
I have circled the tabs/windows that I meant in this pic with red circle.
Note: usually I can access this run tool window by pressing alt + 4.
Please see red circle:
This is my run config:
This is my view tab bar, it doesn't show run (alt+4):
right-click on the code.
More Run/Debug
click on modify run configuration
un-select run with python console
From what I understand you want the run icon pinned to your lower toolbar. (This corresponds to running whatever your last chosen configuration was.)
Two easy steps:
1º View -> Tool Windows -> Run
2º Right-click run icon on lower tool bar -> View Mode -> Dock Pinned
Edit after OP feedback:
If your Run (Alt+4) option has disappeared completely, besides trying a PyCharm reinstall it's advisable to manually clean the preference files that might be hidden. Check the following paths C:\Users\user_name\AppData\Local\JetBrains and C:\Users\user_name\AppData\Roaming\JetBrains, C:\Users\user_name\.PyCharmCE2020.x, and C:\Path_to_your_Project\.idea. Some of there directories might be hidden so you'll have to check you've set them to be visible.
Even by reinstalling PyCharm some of the above configurations are likely to be kept. There's a strong possibility the state of whatever changes that caused Run to disappear is kept in files inside the above mentioned directories.
I've recently switched to VSCode, and am wondering if there's a way to make the Python Interactive Window from the Jupyter support in VSCode work like the console in Spyder where I just have to select code and press ctrl+enter to send it, without having to create cells everytime.
For now I'm resigned to work with the Terminal until my code is clean and then create a cell when I have reusable code, and would like to just work directly with the PIW.
You can always change the default console setting by:
Opening the Command Palette (⇧⌘P)
Typing "Preferences:Open Settings (JSON)
Edit this line:
"python.dataScience.sendSelectionToInteractiveWindow": false
You should be able to do this with the latest python extension. The select the code you want to execute and press shift-enter. Is that not working?
For me (now) interactive mode runs after setting "jupyter.sendSelectionToInteractiveWindow": true
#FranciscoRZ. You should have seen a popup option for this, but if it didn't come up for you it can just be manually set in VSCode options. Just change this guy here:
Python->Data Science: Send Selection To Interactive Window
That should get you what you are looking for.
OP's Note: Accepting this answer because it will be the right anwser starting with the February release of VS Code Python
If you have the notebook saved as a python percentage script (which is more git friendly)
each "cell" will be delimited by # %% and the default run command is "Shift+Ctrl".
Later once you are working in the interactive window, If you want a particular cell you wrote on the fly to be in you script, there is one button which says "Paste code into file" right next to the recently executed cell in the interactive window.
And in case you are using the notebook for the sake of being able to later export it to html or pdf, once executed in the interactive window, there is an export button as well.
I'm running Python 3.6 and Sublime Text 3. I tend to use Sublimerepl to quickly run my code and verify that everything works whenever I make a few changes and close the tab right afterwords. This does mean that when I exit Sublime, I also need to go into Task Manager and end > 10 instances of python ususally. Is there a way to make closing the sublimerepl tab also close the instance of Python that it created?
This probably means that the program is still running in the background, one way to end the instance is to right-click somewhere on the open tab that is running the Python instance and select Kill from the contextual menu, instead of going to the Task Manager.
Are there any smooth way to run Python scripts in the PyCharm's console?
My previous IDE - PyScripter - provides me with that nice little feature. As far as I know PyCharm has 2 ways of running script in console:
1) Select a bunch of code and press Ctrl+Alt+E.
2) Save the code in a file and import it from the Console.
Are the any way to do it by pressing "Run" or "Debug" buttons? I need to see the result of my script in the console and all variables available to manipulate.
In the Run/Debug Configuration, add -i to the interpreter options. This will stop it from closing a python session even after a successful run. I.e. you will be able to see all the variable contents
Run -> Edit configuration -> select the script you want to run and give it a display name -> OK
Now you can run it with the green "Run" button. The green bug button (next to the run button) will run it in debug mode.
Remark: next to the run button you can monitor the script/configuration you run by selecting it's display name.
If you create run-time configuration then after pressing the run button (green "play" icon) you will get the desired result: your code will give you output in a console which opens atomatically at the bottom.
You can create many different configuraions for run and debug within a single project.
Here is a link from PyCharm's web help which covers the run/debug configurations:
http://www.jetbrains.com/pycharm/webhelp/run-debug-configuration-python.html
A possible way of manipulating the variables using debug mode and evaluate expression window is added in comment but I missed one detail: to see the result of your interactive code execution you have to switch from Debugger to Console output; mode tabs are on the top-left side of the bottom pane.
The way I do it is a create my script in the editor, call it myfirst.py, eg
print "Hello"
a= 1234
then in the console I run:
reload (myfirst)
To check on the variables use:
>>> myfirst.a
Not perfect but that's pyCharm for you. If you want a pyScripter like experience which I think is more useful you can try spyder2.
It may also be a good option for you to use the magic command
%run scriptname.py
in the ipython console (including the %-character). Compared to Cntrl + Alt + E you also get clean information on errors in your code.
Due to autocomplete it's also typed in a second and you can use this in any environment with an ipython shell. For me as a scientist who often uses python to explore data, this is a good option.
With your program in the editor:
Run - Edit Configurations
Then under Execution check the box for "Run with Python console".
When you run the program from the green arrow it will run in a console. After the run all your objects are available to examine and play with.
Because of vision problems, I have to keep the font in my Python programs in pycharm larger than the default setting. When I execute any program, the run window comes up at the bottom and every time I have to start working on the Python code in the editor window, I have to close the run window using a mouse.
Is there a way to close it using the keyboard shortcut? I could not find anything in the key map but there are so many settings that there is a chance that I may have missed it.
I also tried with using the distraction free option and it works very well. However, when I tried to find something within the code, it does not bring up the in-line window that allows me to type the keyword is searched for.
Please suggest if there is any way to close the run window or if there is any workaround so that I can return to working in a larger editor window.
Thank you for any inputs
shift+esc will hide the run window from within PyCharm.
If you want to access the run menu use: ctrl+shift+A
You can get a helpful cheatsheet of commands from within PyCharm by going to help -> Keymap Reference. This will provide the default key mapping for Windows and Linux
Have a look at Preferences -> Keymap under Tool Windows -> Run.
On Mac it is CMD+4.