Same question as
Sypder 2 IDE - keep the focus in the editor after sending selected commands to interpreter
but for JetBrains PyCharm. Using option-shift-e on a mac, I can send commands to the python console, but I have to press esc to return focus to the editor. Can I do the Rstudio-style / Emacs-ESS style execution where focus stays in the editor window?
I'm using PyCharm 2.7.3 on Ubuntu 12.04 LTS with Netbeans keymap.
I can use CTRL+ALT+E to execute selected command and for the first time the console has a focus, indeed (first time after lauching IDE). However, any further CTRL+ALT+E leaves the focus on editor. (I can switch back to the console, which is named Run, using ALT+4.)
If newer versions of PyCharm are behaving differently then maybe it's a bug.
Use the built in console and/or built in terminal.
Related
I am writing Python scripts in Pycharm with IPython installed. So I can use Python Console in Pycharm to type Python commands and check the immediate output of the codes. However, when I run a script file after pressing 'Run' button (Shift+F10), all the variables and functions are not visible to the Python Console. This is, however, the feature of Spyder, another popular Python IDE. So here is my question: how can I configure Pycharm so that running a Python script file is visible for Python Console? Thanks
You could also run the part of your code you want to test/check in the console by selecting it and then right clicking and clicking on "Execute Selection in Console Alt-Shift-E". That's what I use sometimes when the debugger is not helpful. After running the code (you can also just "run" functions or classes) the console knows the functions and you can use the same features that Spyder has. However, be aware that when you change the code you need to run it in the console once to update the console definitions!
You can not. But you can use pdb (which will break code execution where you need it and you will be able to do the same things, as in the Python Console).
And, which is better and more powerful, you can use PyCharm's debugger. It represents all available variables in tree-like structures and is really handy.
I recently started using PyCharm with Powershell as terminal shell, however I am experiencing problems with keyboard shortcuts. While terminal screen is active, 'ctrl+c' should interrupt current command, but it is not. Also 'ctrl+end' should clear current line, however this shortcut also is not working.
Is there any way to make PyCharm's terminal properly react to PowerShell's keyboard shortcuts?
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.
PyCharm keeps a command history for it's interactive Python console.
Is there a way to access this history with some sort of search instead of just browsing the entries with the arrow keys in the interactive console window?
My environment: PyCharm 2.7 EAP (124.138) on MacOS X 10.8.2.
As of PyCharm 3.1, while in the console, press ⌥⌘e, the "Browse History" window will come up, start typing to search for specific commands
Not available yet, please vote for the related feature requests:
PY-7922 In console, search history by typing prefix and pressing the "up" key
PY-5011 Ctrl+R in console should invoke history search like in bash
Nowadays, there is "Browse Console History" button located to the left of python console. It works on all OS where PyCharm works.
In Windows and Linux there is Ctrl+Alt+E which does exectly the same, but it may not work on Linux if it is overriden by system hotkey Alt.
In Windows you can use Ctrl Alt e
I am running python 2.7.1. I can't figure out how to launch the IDLE IDE. I am told it comes already installed with python, but I can't find it using spotlight.
In the stock Mac OS X python installation, idle is found in /usr/bin, which is not (easily) accessible from Finder and not indexed by Spotlight. The quickest option is to open the Terminal utility and type 'idle' at the prompt. For a more Mac-like way of opening it, you'll have to create a small app or shortcut to launch /usr/bin/idle for you (an exercise left to the reader).
When you open up a new terminal window, just type in
idle
Then you will see a little rocket icon show up as IDLE loads
Then the Python shell opens up for you to edit
I think the shell command is
python -m idlelib.idle
but i am not a mac user so i can't test.
One way to run IDLE from spotlight or an icon in the Applications folder is to build a quick Automation for it. As mentioned by other commentators, this probably isn't necessary for Python 3, as it creates a shortcut automatically, and some hand-installed versions have tools to do this automatically. But if you want to roll your own:
You'll need to know the terminal command to open your version of IDLE. On my Mac right now (early 2016), running python 2.7.10, it is "idle2.7"
Using spotlight, or in the Utilities folder, open "Automator"
Choose an "Application" type document.
Make sure "Actions" is selected in the gray bar, upper left.
In the actions column, find "Run Shell Script" and double-click it, or drag it to the workflow area on the right.
Enter the terminal command in the parameters box that appears.
Save your automation (I called mine "IDLE" and put it in the Applications folder, to make it easy).
It's now available (as soon as spotlight indexes it) via all the normal methods. The only side-effect will be that while it's running, your menu bar will have a spinning gear over in the tray area next to the clock. This indicates an automation workflow is running. Once you close IDLE, it will go away.
first to launch the terminal CMD+space
second to input idle3
the idle will be activated automatically.
After you launch idle from the command line (make sure idle shell window has focus), click File, click "New File". A new window opens; this is your editor.
Type your program in the editor. Click "File", click "Save As...". Save your file somewhere with any name you choose, and a ".py" extension to the file name.
Click "Run", click "Run Module" (or, F5). Assuming no errors, the results will appear in the Shell window. Edit your file & repeat as necessary.
The answer of Matthewm1970 works like a charm!
And if you add an & to your shell command, the automation script will end immediately. There is no spinning gear. Like so:
/usr/local/bin/idle3.5&
Note the ampersand.
Cheers.
-melle
open Terminal
type "idle" and press enter
right click on "Python" icon > Options > Keep in Dock
so for python 3.4.3 in applications a folder named "python 3.4" click that and click IDLE.
for python 2.7.9 go here https://www.python.org/downloads/ and get 2.7.9 and a folder named "python 2.7" click that and click IDLE.
As to the earlier questions about starting IDLE: you can certainly start it from the command line. Also, if you installed Python using Homebrew, you can run 'brew linkapps' (from the command line); that will place an app for IDLE (among other things) in Launchpad (Applications folder).