[New-bugs-announce] [issue6906] Tkinter sets an unicode environment variable on win32

Michał Pasternak report at bugs.python.org
Mon Sep 14 11:29:26 CEST 2009


New submission from Michał Pasternak <michal.dtz at gmail.com>:

Hi,

I was recently playing with txAmpoule & Twisted on win32. When Twisted spawns processess, the 
environment is checked for unicode variables (and an exception is raised in case of). Then it 
came to my attention, that importing Tkinter on win32 sets an environment variable, which value 
is Unicode. Just have a look:

C:\>python
ActivePython 2.6.2.2 (ActiveState Software Inc.) based on
Python 2.6.2 (r262:71600, Apr 21 2009, 15:05:37) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import Tkinter
>>> import os
>>> os.environ['TK_LIBRARY']
u'C:\\Python26\\tcl\\tk8.5'
>>> ^Z

Why is it Unicode? Does it really have to be? Do we need that environment variable at all?

On Linux, it is different:

root at foo:~# python
Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41)
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import Tkinter
>>> import os
>>> os.environ['TK_LIBRARY']
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.6/UserDict.py", line 22, in __getitem__
    raise KeyError(key)
KeyError: 'TK_LIBRARY'

----------
components: Tkinter
messages: 92594
nosy: dotz
severity: normal
status: open
title: Tkinter sets an unicode environment variable on win32
versions: Python 2.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6906>
_______________________________________


More information about the New-bugs-announce mailing list