PyCharm won't accept code completion on enter - python

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

Related

Spyder - stop consoles accidentally closing

When I use Spyder, I have fairly frequently accidentally closed the wrong consoles. Usually by a cmd+W. Most applications ask if I want to save before close/confirm I definitely want to close. Spyder just closes, so I may lose training that's been occurring for an hour, say, by a single click or keyboard typo, and I cannot find a way to get it to ask before it does close a console.
Anyone know how to fix this?
You could use hist -g in the console to get your history back.
And you could do this:
Tools > Preferences > General > Advanced Settings
check Prompt when exiting

What does it mean to "restart" a program (in my case IDLE)?

This answer on Stack Overflow offers a solution I am trying to implement. In particular, see the sections "Installation Instructions" and "How to Use".
Can anyone tell me the steps required to "restart" IDLE?
New Information:
Just as people have suggested I thought this simply meant closing the program and opening it back up again...but I already tried that.
The other twist to my situation is that I'm working on a virtual machine so I was unable to do the installation of IDLE2HTML.py myself. My work's Help Desk had to do it so I cannot speak for the accuracy of their work. For now I'm assuming they did it correctly, but when I go to the "Options" menu there is no option to "Save as HTML".
My only guess at this point is that I still need to "restart IDLE".
Just wanted to double check if there was something else I could do before going back to my Help Desk department.
IDLE reads the idlelib/config-xyz.def files, including config-extensions.def, just once, when it starts. So any changes to config-extensions.def only takes effect the next time you start IDLE.
If you do not see 'Save as HTML' after starting IDLE, the extension is not installed properly.
It means you need to close the IDLE so that any changes made by the script can affect the IDLE
Simply close the IDLE either via the X, Ctrl+Q or File>Exit, then open the IDLE again.
If you are using idlelib module from a Python program then close your program and run it again.

keep ghostscript running - even if fed garbage

Short version: how can I tell ghostscript, "keep going, even if you find garbage" when running in batch mode?
Longer version: I have a bit of Python code on Windows that uses check_subprocess to call Ghostcript. (I'm merging several PDFs into one).
popenargs = [r'C:\Program Files\gs\gs9.15\bin\gswin64.exe'
,'-dBATCH'
,'-dNOPAUSE'
,'-dLastPage=5'
,'-q'
,'-sDEVICE=pdfwrite'
,r'-sOutputFile=C:\temp\bar.pdf'
,r'c:\temp\a.pdf',r'c:\temp\b.pdf']
subprocess.check_call(args)
While things are running, you see the Ghostcript window pop up and disappear, and that's OK with me.
The problem occurs when ghostscript encounters a corrupted PDF. It leaves the window up, with some details about the error, and instructions to close the window manually. This is problematic, because it leaves the python script hanging. I don't want that -- if an error is found, that's OK with me -- I just want the file skipped and for things to keep moving.
Is there any way to tell Ghostscript to do what I want?
I would have to see an example to say for sure, but the simple answer (on Windows) is no.
You could, of course, use gswin64c.exe instead, its much more suitable for automation anyway.

Why does powershell freeze for a bit when running my python scripts

Sometime I look back at my terminal when there is a python script running and the console output has frozen, then I right-click on the terminal and the console output (printing to screen) beings again.
Its a bit disconcerting because sometimes I think my script has broken.
Do others also experience this? Anybody know a fix?
Thanks in advance for any responses
If it's intermittent with all other factors being unchanged, it sounds like you've inadvertently selected some text in the PowerShell console and it's halted updating output so that you can do something with it.
Next time, be careful to look to see if you have something selected before clicking.
I agree with #alroc's suggestion; i.e. the cause could be accidentally clicking on the console.
A solution to prevent this is to right click on the powershell console window's title bar, select properties, uncheck Quick Edit Mode, then click OK. This disables some features (i.e. copy by select & enter, paste by right click), but means if you accidentally click on the screen it does no harm.
Another solution's to simply press escape (or right click in the script's window) if the script's taking a while - generally that'll do no harm (i.e. it won't terminate your script), but it will exit the edit session, allowing the script to resume if it had been paused due to edit mode.
To play with these, run the below script, then click on the screen whilst it's running (this script just outputs a bunch of numbers).
1..99999999
To terminate the script completely, press ctrl+c.

Eric4 Python IDE - autosave and quick script/project start, run

I've got 2 problems with Eric4 IDE.
Can't find an option in preferences to autosave my changed files before running script. It's very annoying that I have to save my file and then run script.
Second problem is running a script. I can't find any button to run a script/project instantly. 'Run Script' button always opens a setting window.
One way to get around this, as it seems there is no built in way is to bind a key to save the file (ctrl+s), then run the script (F2), and finally hit enter (to close the settings window and run the code).
This bothered me a lot too, and I know this is 2 years late but it might help some else who comes here looking for this very solution, like I did. Here are the actual answers, ERIC v4.4:
Press F4 instead of F2.
The first time you have to use F2 to 'Start' the script, so dismiss the settings window. After that you can use F4 'Restart' and it will run with the settings you chose initially.
The Autosave option is well hidden unfortunately:
Settings-->Preferences-->Debugger-->General-->!Scroll down to!-->Start Debugging-->Autosave changed scripts
And you were spot on - these two things do have a huge impact on productivity.

Categories