python 2.7 - IDLE 2.7.11/12 "NameError: global name 'Toplevel' is not defined" -


i ran apt-get update on debian based os on oracle vb. while running messed around python code in idle 2.7.12 (i opened terminal). after finished updating, tried saving code. in terminal opened idle got error. says this:

root@kali:~# idle

idle opens, load code, edit code, click [file] [save]

this happens

exception in tkinter callback traceback (most recent call last):   file "/usr/lib/python2.7/lib-tk/tkinter.py", line 1545, in __call__     return self.func(*args)   file "/usr/lib/python2.7/idlelib/scriptbinding.py", line 140, in run_module_event     filename = self.getfilename()   file "/usr/lib/python2.7/idlelib/scriptbinding.py", line 205, in getfilename     self.editwin.io.save(none)   file "/usr/lib/python2.7/idlelib/iobinding.py", line 345, in save     if self.writefile(self.filename):   file "/usr/lib/python2.7/idlelib/iobinding.py", line 378, in writefile     chars = self.encode(self.text.get("1.0", "end-1c"))   file "/usr/lib/python2.7/idlelib/iobinding.py", line 450, in encode     dialog = encodingmessage(self.editwin.top, enc)   file "/usr/lib/python2.7/idlelib/iobinding.py", line 76, in __init__     self.root = top = toplevel(master) nameerror: global name 'toplevel' not defined 

picture of terminal error

i have tried restarting vb, , i've uninstalled, autocleaned, re-installed idle no luck.

the problem bug in updated version of idle. add following near top of .../lib/idlelib/iobinding.py, instance before import tkfiledialog.

from tkinter import * 

the nameerror occured in function displays warning following message:

non-ascii found, yet no encoding declared. add line -*- coding: <enc> -*- choose ok save file <enc> edit general options silence warning 

where <enc> encoding such utf-8.

it occurs me message might more helpful beginners if pointed python language reference, section 2.1.4., encoding declarations

this bug 2.x specific because in python3, utf-8 default used in absence of encoding declaration.


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -