Why do control keys and arrow keys not work in pycharm? - python

I use MobaXterm to control linux server remotely from my windows desktop. I use Linux and pycharm 2019.3 in the linux server for nearly one whole year. During the past year I can not use control keys in pycharm. To be specific, when I press arrow left, endless number 4 will be inserted in pycharm until I type a normal character from a to z. Similary, when I press arrow right, up, and down, endless 6, 8, and 2 will be inserted. Furthermore, when I press insert, delete,home, end, page up, and page down, endless number 0,.,7,1,9, and 3 will be inserted into pycharm editor area until I press backspace or a normal character.
I tried to upgrade my pycharm from 2019.3 to 2020.2, but the same issue still exist.
I can not delete any thing, I have to use backspace to replace delete, it is awful。
I have been suffering the problem for one year. Please help me!
-----update------
I also found that when I disable the number lock, I can still type normal number using numeric keypad. Very weird.
-----update2-----
I found when I open the pycharm and just press control keys, everything goes well. But once I press a normal character (like a-z), this will trigger the issue, after that, control keys will not work normally.
-----update3-----
I uninstalled pycharm completely, and install it again. the issue still exist.
I restored default setting, the issue still exist.
-----update4----- This issue is related to: https://youtrack.jetbrains.com/issue/IDEA-150932
and
https://intellij-support.jetbrains.com/hc/en-us/community/posts/206345169-Scrolling-with-keys-on-numeric-keypad-with-num-lock-off?input_string=Using%20Numeric%20Keypad%20Arrow%20Keys%20in%20CLion
-----update5----- This issue only exist in pycharm. Everything works correctly outside pycharm.

I know why! How to fix PyCharm keyboard keymap numpad left, right, up & down Ctrl BUGs
PyCharm latest version 2021.2 and many previous versions have 3 types of bugs in Keymap usually with larger keyboards with numpads on the right. (There are more bugs/Trojans in plug-in specific keymaps, that may already use or have conflicting uses of key+mouse+key combinations.)
First to fix the bug (eg missing numpad "left" arrow), open pycharm:
(optional) Update pycharm+its plug-ins and restart.
(optional) Running out of disk space? Delete ONLY the older backup PyCharmCE??? directories that do not match your
[ Help --> About --> Version ] value. Those configuration directories under Linux are ~/.cache/JetBrains/. Obviously do not delete the current PyCharmCE??? version. Windows has a similar set, I think. The bug here is the .cache/JetBrains directories are HUGE, and pycharm update fails to delete the oldest versions 3 versions back!
Go to the editors main Keymap: Ctrl+Alt+s --> Keymap --> Editor Actions and find the keystrokes that offend you, in my case "up" "down" "left" and "right" which are PyChuggyBuggeyWuggy dead unresponsive keys on the numpad.
Strange you will find "up" "down" "left" and "right" already coded into that list. All you do is add the keystroke of interest for each, even if it already looks good, IT IS NOT!
Each action in the Keymap list can have one or more keystrokes. Do not delete the existing keystroke, you will be adding your new one.
Double click on the chosen key in that very long Keymap list eg "left" --> "Add keyboard shortcut" (Confusingly it already says "Left" ignore that, it means non-numpad left, it is a bug).
JUST PRESS YOUR OWN LEFT arrow key (on the numpad) on the keyboard. then press OK. A new left appears, it looks the same but is not ... BUG!
Press Apply --> OK. It just added ANOTHER Left. That is actually a different Left! (That is a BUG and it should say "numpad left"). Test your changes.
For ANY other keystroke or mouse+key combo you can do the same thing, pycharm
may not record the "name" of the action correctly, but it will remember the combo for correct use against each list under: Ctrl+Alt+s --> Keymap --> Editor Actions
MAJOR BUG2 PyCharm SECURITY FLAW. Pycharm repeadedly phones home along with PlugIn violating security at least 160 times a day! Not
asking your permission. The atom editor and sublime do the same, do
not tolerate that, BLOCK THEM with the firewall.
MAJOR BUG3 PyCharm SECURITY FLAW. Plugins have the ability to intercept any and every keystroke and use the Keymap.
Many of the plug-ins are "builtin" and others are optional. They can be updated with fake versions that are trojan horses that capture
keystrokes. I do not see any way of verifying plug-ins, but I do see them violating security and phoning home information without your permission.

Related

breaking out of python shell prompt "...:" in enthought canopy

Context: using Enthought's Canopy Version: 1.7.4.3348 (64 bit) on Windows 10.
Typing into the python shell, errors produce a "...:" prompt, which I can then not break out of. Hitting enter and trying other ideas sadly leads to a repeat of the same prompt. How to break out of this mode, and get on with debugging?
EDITED, see bottom of answer
The key point to understand is that when IPython prompts you with ..., it is because you are in the middle of typing a multi-line statement (whether that was your intention or not). Typically this is because on some previous line, you typed a left parenthesis (or bracket), or a triple-quote-mark, etc and IPython is waiting for you to complete your statement with a right parenthesis or matching triple-quote, etc.
So what you probably want to do is simply to erase your partially entered statement. The easiest way to do this, assuming that your cursor is already at the end of the last line in your multi-line statement, is just to press and hold the backspace key until your statement is all erased. Slightly quicker is to do the same with Ctrl+Backspace, which erases a word at a time instead of a character at a time. After you've erased all the garbage, press Enter, not actually needed but it will make you feel better, to convince yourself that everything is back to normal.
(BTW, the fact that you were actually in the middle of typing a single long statement also explains why typing "quit" does nothing; you are not really typing a "quit" command, but just typing the additional letters "quit" into the middle of your already too-long and erroneous command, whatever that might be, which makes it even longer and more erroneous!
As a further side note -- quit is actually not very useful in Canopy's IPython panel, because it just closes the panel but doesn't really close down IPython; if you reopen the panel from the View menu, it is still just as you left it. If you really want to restart IPython (clear all your variables and imports), do it with the "Restart kernel" command in Canopy's Run menu.)
EDIT:
OP's screen shots, sent privately, showed that Autodebug mode was on (this is the bulls-eye-like icon on the toolbar.) The solution was to toggle off Autodebug.
Background: Autodebug hooks into the channel between Canopy's IPython (QtConsole) front end, and the IPython kernel back end. If autodebug is left on, some problems can break this channel. This should be improved in Canopy 2.0, currently in alpha internally.
Try pressing Ctrl + D, that help in coming out of the console panel.

PyCharm won't accept code completion on enter

since yesterday PyCharm 2016.3 won't accept selected lines from the list of code completion:
If I hit enter, a new line will be set into the editor rather than the selected line of the popup window. Is there any setting for this behaviour? Until now I couldn't find anything.
I noticed on a few occasions the GUI going somehow off-rails, including in ways similar to the one described. I couldn't determine a pattern in the occurences. Just closing and re-opening the project didn't always help.
What worked pretty reliably for me in the end was exiting PyCharm (giving it ample time to finish), making sure no related java processes remains active (running on Linux, in some cases I had to manually kill such processes when it became clear they're not going away by themselves) and then re-starting the IDE.
I found the current keymap for code completion by chance. This is set via:
Settings > Keymap > Code > Completion > Basic

How to copy text from IDLE?

Is there a way to copy text out of Python IDLE on a Mac? When I highlight text and copy then past into a text editor, I get the same text pasted. It is some of the first text I start with in IDLE. None of the other text will copy out.
From The Things I Hate About IDLE That I Wish Someone Would Fix (from 2011):
1.2) NEW FEATURE: Auto-Copy-On-Highlight
Once we get rid of being able to move the cursor off the last line, that opens a new opportunity to implement an automatic copy-on-highlight feature that many terminal and IRC client programs implement. Since this text is read-only, the only reason a person has for highlighting it is to copy it (they can’t delete it.) As soon as the user highlights text in the shell window, it is copied to the clipboard.
Looks like the best you can do is save as a .py file. Open that in a text editor and continue working in IDLE. With each save, the text editor will refresh with all updates, including errors. At least TextWrangler will.
Sometimes in things like a linux terminal you can't do a normal copy and paste, try holding Command/Control + Shift + C after highlighting things and seeing if that works, since you're on mac i'm not sure if it would be the Command or Control key so try both
EDIT: There is an apple discussion about the exact same thing. They discuss going into the options menu, then into configuration and navigating to the keys section. Then you use a built in key-set, their suggestion is using IDLE Classic Mac.
I cannot tell from your description exactly what you did and what happened. But I can recommend that you upgrade to 3.4.4 or 3.5.1 (or 2.7.11 for 2.7 users). Among other improvements, they all contain a patch to make right-click for context menu work on Mac Aqua. This was issue 24801 on the CPython bug tracker.
If there is still an actual problem on Mac, I would like to know so it can be fixed.

Aquamacs (on Mac lion): whatever I write i being interpreted as "Enter"

I am editing a python script that I wrote a while ago, using aquamacs on Mac lion.
Whichever letter or number I type is being interpreted as "enter" (that is, I hit "g" for example, my text is dissrupted and a newline appears, but "g" does not appear). Restarting aquamacs, the terminal out of which I run it, or the whole computer did not help.
Other observations (that might or might not be connected):
- The script is located in a folder under Dropbox
- The file has special attributes (that is an "#" appears at the end of the permissions, upon typing ls -lah)
- I might have hit a combination of Control, Apple and other keys that I should not have ....
Any solution to this would be very much appreciated (and my apologies, if that has been treated before).
Thanks!
I also met with this problem recently.
You need to add minor mode Fill. Press on the Python in the mode line in mouse-3 way and choose Auto Fill.

Using the emacs bindings in pycharm in OS X Lion

I am trying to use the emacs keybindings in Pycharm 1.5 in OS X 10.7. They all work except that ALT+B inserts a beta symbol rather than moving back a word. It's puzzling since ALT+F does correctly move forward a word.
Also, I was wondering if Pycharm has support for moving between matching parentheses or brackets, like Control-Meta-F in emacs. I didn't see an option for this in the Pycharm keybindings preference pane.
Thanks!
I found a solution on the JetBrains forum. The forum post includes a keymap as an attachment that globally disables the alt keys from generating symbols.
Quoting the forum,
"So, after some digging around, I figured that this option key maps to these relatively unused symbols that are take precedence in the operating system. Using http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=ukelele (Ukelele), I was able to generate an optimized Emacs keyboard layout. You should take this and put it in your /Library/Keyboard Layouts/ folder.
Reboot, and switch to use this keyboard layout on the Mac OSX toolbar and the option key will be free for hotkeying in PyCharm. I'll write up a blog post about this later.
Hope this helps."
esc-ctrl-b works for me, but alt-b doesn't. It's right there in the emacs keymap, so it's strange at first, but I think the problem is that alt-b is mapped to a character (∫ rather than ß in my case) so PyCharm doesn't see it as a key-modifier pair, just a single character.
Switching to a different international keyboard map will change which combinations work and which don't. I'd suggest sending a bug report to PyCharm as it's something they can fix, or alternatively you'll have to hack your keyboard mapping somehow.
To answer your other question, I don't think that there's a way to go to matching parenthesis, or at least I've never found one.

Categories