Last Updated on March 27, 2023 by Dave Farquhar
PyCharm is a lifesaver for developing in Python, but it has a glitch. Sometimes, after you run a script, you lose the ability to type in the editor and make changes. Loads of web sites offer elaborate suggestions to fix the problem, when PyCharm doesn’t allow typing, but frequently, these complex solutions don’t work. Frequently they cause other problems. Try the easy solutions first.
The two easy solutions are to double-click on another file in your project, then double click on your script again. And if that doesn’t work, just exit PyCharm entirely and relaunch it.
Fix the inability to type in PyCharm in 30 seconds or less
PyCharm is an indispensable tool for programming in Python, but it has a maddening habit of not allowing typing sometimes. Fortunately it’s easy to fix when it happens.
Before you go rebuilding your environment or some other wild goose chase, take 30 seconds to try the easy solutions. The easiest of the two solutions really does take seconds. Typically, the problem happens when you run a script, then you click in the output window so you can scroll through it and read the error messages, and then, when you click on your script again, you can move the cursor around but you can’t type. Of course I’d find this problem, because most of my scripts dive deep into JSON structures and I always miss a level. Except when I mistype a level. Or both. Trust me, I know errors, so I probably run into this problem once a week.
When that happens, just look to the left, where all the files in your project live. Double click on another file in your project and see if you can type. If you can, great. You fixed your problem. Double click on the file you were working on, and you’ll probably be able to type there too.
It takes two seconds to try, and it takes 25 seconds to find your place again. It’s an unwelcome interruption, but it’s a lot better than spending half your day rebuilding your Python environment.
The less easy solution that’s still better than rebooting
In my experience, I’d say the solution above works more than 90 percent of the time. So always try that first, because it’s fast and easy and usually works. When it doesn’t work, there’s another easy solution that takes a bit longer, and it sounds like a cop out, but when you can’t type in PyCharm and my double-click fix doesn’t work, exit PyCharm completely and restart. Yes, it’s almost like a reboot. Yes, it sounds like a cop out. But it’s always worked for me.
It’s usually overkill to exit PyCharm and restart it when PyCharm doesn’t allow typing, but it’s much better than rebuilding your environment. If exiting and restarting doesn’t work, then absolutely, go try those other, more complex solutions. But before you do that, try the simple solutions first.
I don’t think I’m exaggerating to say I’ve run into this typing glitch more than 100 times, and I’ve solved it every time with one of these two fixes.
I don’t claim to be an expert on Python, but some of my code has ended up doing important things for companies you’ve probably heard of. I’m happy to share some things I’ve learned along the way:
Iterating over a CSV in Python
json.loads vs json.dumps in Python
Calling the Shodan API in Python