2

I'm running python 2.7 in Ubuntu 13.10, and idle (idle-python2.7) has stopped working. Whenever I try to open a file in a editor window, it is blank, though the file does exist and is not empty/blank. Furthermore, it is not possible to close idle after this, except via a terminal kill command.

  • Idle was working fine before. The problem appeared after I installed a number of things, including idlex, various scipy modules and mpmath, but after trying to repair it in several ways, it seems to be caused by Ubuntu's official idle package.

I get this error in the terminal when trying to open a file in idle:

Exception in Tkinter callback
[...lines ommitted for brevity...]
File "/usr/lib/python2.7/idlelib/IOBinding.py", line 129, in coding_spec
    for line in lst:
NameError: global name 'lst' is not defined

If you look at the code, it looks like an obvious bug: indeed lst is not defined in the function coding_spec. Furthermore, the source file IOBinding.py in http://fossies.org/dox/Python-2.7.5/IOBinding_8py_source.html is different and doesn't show the problem.

Thinking that one of the recently packages had overwritten the file somehow, I've tried a number of things, including reinstalling all Python packages from synaptic, but the wrong IOBinding.py is still there. The reason I think the problem lies with the package itself is that I finally did sudo apt-get remove idle, verified that the idlelib directory was empty, and reinstalled with sudo apt-get install idle; but the wrong IOBinding.py file came back again.

I can in fact make idle work again by simply replacing lst by str in the code, but to me that's clearly a no-no. I'm not to happy either about trying to replace just that file from the source python distribution, as other files may be wrong. I want to get the right files from the official package.

1
  • I am also having this problem, although I think you mean UBuntu 13.1
    – Ravin
    Nov 11, 2013 at 15:57

1 Answer 1

0

It's a 'me too', with no solution.

...until I searched for the specific error.

Edit the file

/usr/lib/python2.7/idlelib/IOBinding.py

and replace this line in coding_spec function:

str = str.split("\n", 2)[:2]

with:

lst = str.split("\n", 2)[:2]

http://ubuntuforums.org/showthread.php?t=2182753

1
  • Thanks, but I already mention this solution in the last paragraph of the question. I was hoping there was some official source with the correct, error-free files.
    – adelval
    Jan 9, 2014 at 18:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .