Pycharm powershell shortcut - python

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?

Related

Why Do My Python Scripts Pause in Terminal?

I have some Python scripts which I am running in Windows using Command Prompt by entering the following command: python -m scriptname.
I have noticed that quite often, these scripts randomly pause and stop running. I can resume them by typing any key in Command Prompt, but I have no idea why this is happening or how to prevent it all together. Has anybody encountered a similar problem, and does anybody have any suggestions they may be able to offer?
Right click on the cmd window, and click on properties. Check if you have QuickEdit Mode on. If you do, uncheck that box.
This is a known issue for command prompt that if you click on the window, it will enter select mode, which will pause the program.

Use of input() statement

I am new to Python and Visual Studio Code. When I try to use the input() statement and run the code, the terminal window shows the prompt which I have included in the statement but does not show a curser after the prompt where the user should type in the input. I need to mouse click in the terminal window after the prompt and then press enter for the input to be accepted. This doesn't seem right. Any ideas?
If you run a python script in an IDE, it will fire up an integrated terminal and will execute the program by doing something like python <your_file_name>.py.
This process isn't supposed to change the IDE's focus to the terminal. Because often times, developers like to have their editor in focus even though their program is running in the terminal. And hence VSCode is developed to behave this way. You can see this exact behaviour in many modern IDEs.

Python in VSCode: How do you run a previous command?

I'm kind of new to software development. Outside of VSCode, I can open up a terminal (let's say PowerShell), run python in it, type in a command (like 2+2), be able to click the up arrow key to find my previous command so that I can run it again.
If I run PowerShell in VSCode and do the same thing, nothing happens when I click the up arrow where I would expect my previous command to be cycled.
Is this a problem with my Python or VSCode? I've been looking for a solution for this but haven't found many useful topics on this.
This was going to just be a comment but its too long. Sorry it isn't more informative than it is. This is kind of an odd problem because VSCode isn't a true IDE. It doesn't have its own shell and just hijacks your powershell or bash terminal, depending on which OS you are using. You should be able to use your up and down arrows just like you can in powershell. I have tested it on my own VSCode installation and it works fine for me. If it's a problem, it's not with python, since VSCode will interact with the terminal the same way no matter which language you are using it for, so its probably with VSCode or your terminal. I have heard of others having issues with up arrow autocomplete in bash, so if you are connecting to a bash terminal that could be it, but I've never heard of it glitching in powershell. I'd say check which terminal you are using, see if the problem persists when you change terminals, and try reinstalling VSCode if it does. Past that, I don't know what to tell you.
I found a work-around. For me, neither git bash, nor PowerShell allowed up/down arrows for history switching within a python shell. So here it goes.
Ctr-Shift-P opens VSCode commands
Python: Create Terminal does not actuallt start python, but it does launch powershell in a mode that will enable us to succeed
py starts python shell with working up/down arrows!

pycharm - keep focus in editor when sending commands to python console

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.

Python shell unresponsive in emacs

I'm trying to use emacs as my python develloping environement. But I'm facing a problem.
All communication between emacs and any python interactive shell that is called by python-shell seems broken:
The shell seems to start normally, displaying versions and giving me a prompt but then as I enter commands, nothing seems to happen. I have no answer from the interpreter. I can keep writing things but they then stay there in the middle of the screen and nothing happens. I've tried setting regular python interpreter to python and ipython and nothing changes.
I also try to invoke a system shell, that works correctly, and then call python or ipython from there, that brings me back to the same "no response" situation. It just looks like a normal buffer that I can edit. I can delete through the prompt, write some character anywhere in the screen, in the version info... It doesn't looks interactive at all.
What could be the reason of this problem?

Categories

Resources