How to run a file in SublimeREPL? - python

To run a file via the SublimeREPL plugin, I select 'Tools' -> 'SublimeREPL' -> 'Eval In REPL' -> 'File'
When I select 'File' nothing happens. How do I configure Sublime Text 2 to use a specified REPL ?

I think SublimeREPL only supports this for python files, if you look here you'll see that it is only under the python heading that this feature is mentioned.
Python
Launch python in local or remote(1) virtualenv.
Quickly run selected script or launch PDB.
Use SublimeText2 Python console with history and multiline input.
Besides if you press(on windows) shift+ctrl+p you'll see that if you type repl current it will say:
SublimeREPL: Python - RUN Current File
As the only alternative, well except for PDB.

As #daniel-figueroa states, SublimeREPL only runs Python code as far as I'm aware.
If you are just trying to run Python with SublimeREPL, try:
Tools -> SublimeREPL -> Python -> Python -> RUN current file
Alternatively, if you're actually intending to evaluate with SublimeREPL, the plugin author, #wuub explains and offers a solution HERE.

Related

What's the difference between executing python code via a task and "Run Python file in Terminal"?

I am just getting my feet wet with Python in VScode. I'd like to know what the difference is between using an extension like the Code Runner Extension (or creating a custom task) to execute Python code and just right-clicking the Python file in the editor pane and selecting, "Run Python file in Terminal or Run current file in Python Interactive Window? What are the pros and cons between the two methods?
its about performance hit
creating a custom task or Run Python file in Terminal
is equal to running python my_code.py in a terminal, and has almost no performance hit
any interactive and second layer for running python has some performance hits, e.g.
Run current file in Python Interactive Window or using an extension like the Code Runner Extension
but don't forget the good things that come along with interactive running and extensions that make these performance hits bearable
The actions you see when right-clicking your file are an implementation of a VSCode extension that you have installed (Python base extension). What ultimately differs depends on the implementation of the specific extension (which you can check only by looking at their implementation) but I think that the main difference is in where your code is getting executed for you, which may be a new interactive window, an integrated terminal or vscode output window.
Run Python file in Terminal simply opens up terminal in vsc in which the python script runs.
The interactive terminal has a ton of fuctions im to afraid of too explain but i have found this neat documentation about that.
https://code.visualstudio.com/docs/python/jupyter-support#_python-interactive-window

python-shell history

When I code in shell for practicing and when I am done I close it, when I reopen it I cannot code in it again I have to open a new one !
How can I code in the same old one of shell ??
python command doesn't preserve your work
You can try installing IPython, Jupyter, or use a proper IDE for practicing
The python shell isn't meant to write full programs. It's nice for testing small pieces of code, but if you'd like to continue previous code, use the Python IDLE that comes with the standard download installation (in python shell -> File -> New File). This will require you to save the file to run the code. However, this IDE is not very user friendly. As user cricket_007 has mentioned, there are other IDE's that have autocomplete and other helpful tools.
Start using a terminal multiplexer like tmux or screen and launch python under it. My favourite is tmux. Your python session would persist till you kill the tmux session or till logout / reboot

How to run python script without writing command on cmd again and again

I am practicing python code and executing it through command line. each time i have to execute my python file i go to cmd and write
D:\PythonPractice>python myClass.py
Is there any standard and comfortable way available to execute python code quickly?
If you are executing the same command, with no changes to arguments or anything, you can pack it in a .bat file (windows executable)
Name it something like myscript.bat
D:\PythonPractice>python C:\path\to\myClass.py
Put full path inside it. Now double click will do.
Use PyCharm Software by JetBrains (same company who developed Android studio and Kotlin language), it will help you in many ways .
Run Python with single press of a button.
Add modules easily just with some clicks.
Debugging the code as smooth as possible.
It is Awesome, I am using it for past couple of months.
you can change file association which controls what to do when invoking filename in command line. For instance, when you just type text filename in cmd, notepadd will be opened, for word docs Word or other document editor.
Have a look into following link from google or you can fiddle by yourself starting from Control Panel > Control Panel Home > Default Programs > Set Associations. Select a file type in the list and click Change Program.
Alternatively,you can use any of Python IDE (PyCharm,PyDev etc.) so you will be able to run directly scripts from editor.
With Notepad++, you can also create a shortcut to be able to launch your python script :
Menu Run > Run (or press F5)
Choose the python .exe (default in C:\Program Files (x86)\Python36-32\python.exe
Then add this code next to the path : "$(FULL_CURRENT_PATH)"
This will allow to execute the current file
example of command with Python 3.6 :
"C:\Program Files (x86)\Python36-32\python.exe" "$(FULL_CURRENT_PATH)"
Then save the command, by assigning a shorcut key, it's better with a modifier like SHIFT (SHIFT + F10)
Now you can launch any script with this shortcut.

SublimeREPL: Python - RUN Current File

With python script currently opened in SublimeText I'm choosing:
Tools > SublimeREPL > Python > RUN Current File
Sublime executes the script in a new interactive REPL[python] window (this window is still inside of Sublime).
After the python script execution is finished Sublime types:
Repl Closed
I now can start typing the python commands into this interactive window below "Repl Closed" message. But when I press an Enter key the editor simply advances to a new line when I expect it to Execute a line I just typed.
Please advise what key (if any) should be used to run typed command.
First, go to Tools -> SublimeREPL -> Python -> Python to start a new Python REPL. You can then use the commands in Tools -> SublimeREPL -> Eval in REPL and Transfer to REPL to transfer and/or evaluate pieces of your code in the running interpreter. When that code is done running, the REPL stays open, allowing you to enter new commands as you'd expect.

Open python interpreter on intellij

I'm new with python 3.3.
I'm using intellij IDEA 12.1.6.
How can I open the interpreter window, the one with the '>>>' prompt?
Thanks
I am using IntelliJ IDEA 13.1.4 Ultimate with the JetBrains Python Plugin 3.4.135.24.
After installing the plugin and restarting the IDE, I can open the iPython console exactly the same way as in PyCharm, i.e. clicking Tools -> Run Python Console in the menu.
Another option is by selecting some code in a .py file, right clicking and choosing Execute Line/Selection in Console or pressing Alt + Shift + E. If the console has not been opened already, it will open now.
Using the console integrated in the IDE has a few advantages over running iPython alongside it, as listed at in the linked PyCharm documentation page.
Go To Tools -> Python Console
If you want to program python exclusively you may have a look at Intellij's little brother PyCharm. It is specifically designed for python development: http://www.jetbrains.com/pycharm/
Under PyCharm you can open an interactive Python session by selecting Menu->Tools->Run Python Console...
In Intellij (community edition) in terminal (I use Linux, this might differ in your case) I type python3 and it works the same way as in pycharm. With "_" as return value etc. I find this rather useful.

Categories

Resources