Message187418
Calling Tkinter.Tk() with baseName keyword argument throws UnboundLocalError on Python 2.7.4.
A process to reproduce the bug:
>>> import Tkinter
>>> Tkinter.Tk(baseName="test")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1748, in __init__
if not sys.flags.ignore_environment:
UnboundLocalError: local variable 'sys' referenced before assignment
A patch to fix the bug:
--- Lib/lib-tk/Tkinter.py.orig
+++ Lib/lib-tk/Tkinter.py
@@ -1736,7 +1736,7 @@
# ensure that self.tk is always _something_.
self.tk = None
if baseName is None:
- import sys, os
+ import os
baseName = os.path.basename(sys.argv[0])
baseName, ext = os.path.splitext(baseName)
if ext not in ('.py', '.pyc', '.pyo'): |
|
Date |
User |
Action |
Args |
2013-04-20 11:57:47 | y-fujii | set | recipients:
+ y-fujii |
2013-04-20 11:57:47 | y-fujii | set | messageid: <1366459067.56.0.563805479218.issue17803@psf.upfronthosting.co.za> |
2013-04-20 11:57:47 | y-fujii | link | issue17803 messages |
2013-04-20 11:57:47 | y-fujii | create | |
|