Pakochu
Pakochu

Reputation: 91

Python IDLE won't start

IDLE just straight up stopped working on my desktop, as in when I try and open it nothing happens, it won't even give me an error message. It works fine on my laptop however. Right-clicking and trying to edit a script does nothing as well. This happened completely overnight, I didn't change or install anything. I have absolutely no idea how this happened.

I've tried reinstalling and copying the files from my laptop to my desktop, nothing has worked so far.

Upvotes: 7

Views: 18031

Answers (3)

PythonLearner
PythonLearner

Reputation: 1

After I ran the command python -i -m idlelib., the response was that IDLE cannot import tkinter. I insert command line at terminal: install python-tk@3.9

I used homebrew and installed python 3.9 with homebrew in the first place, so I tried to install tkinter 3.9 back, after that I can open IDLE.

Upvotes: 0

James Lamm
James Lamm

Reputation: 1

I had a lot of trouble with Python, it suddenly did not work. Reinstalling did no good. One thing which did work was that I created another user on my laptop and reinstalled for that new user and that worked. Also, I got it working on my original accout by going to the web page with chrome and reinstalled it and it still did not work from the microsoft button. So I found idle at C:\Users\jlamm\AppData\Local\Programs\Python\Python310\Lib\idlelib\idle.pyw and typed that (using the full path in my command) in to the command prompt.
It worked and provided an icon I could pin to the taskbar. I also noticed that (C:\Users\jlamm.idlerc) is a Python folder that does not get destroyed when I uninstall.
A page said a corrupt file there could make Python bomb so I deleted it even though that did not work for me.

Upvotes: 0

Terry Jan Reedy
Terry Jan Reedy

Reputation: 19174

(Answer adapted from comment with solution.) When starting up, IDLE accesses both its own files in Lib/idlelib and user customization files in $HOME/.idlerc. The latter are shared across all python/IDLE installations on the machine. The error message you got indicates that some file 'suddenly' became corrupted so that it was seen as mis-encoded. Since replacing the idlelib files did not fix the issue, the problem likely had to be in a .idlerc file. Your comment indicates that this must have been the case.

With no .idlerc present, IDLE will recreate one from scratch. Any customizations you had can be re-created with the options dialog. You can either delete the old version or try to poke around to retrieve some of the data.

I will look into adding something to the IDLE doc about .idlerc corruption being a possible problem, and the solution.

EDIT: Bit can occasionally go bad on a hard disk, especially after several years. Has happened to me. To fix, only only needs to delete the bad file or file within .idlerc if .idlerc itself is not the problem. An IDLE error message may indicate which. Or one can try looking at each file in an editor for any obvious garbage.

Upvotes: 3

Related Questions