This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2009年09月14日 09:29 by dotz, last changed 2022年04月11日 14:56 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| FixTk.diff | ggenellina, 2009年11月14日 22:06 | |||
| Messages (11) | |||
|---|---|---|---|
| msg92594 - (view) | Author: Michał Pasternak (dotz) | Date: 2009年09月14日 09:29 | |
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@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' |
|||
| msg92666 - (view) | Author: Gabriel Genellina (ggenellina) | Date: 2009年09月16日 08:05 | |
I cannot reproduce it with the python.org version: Python 2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. py> import Tkinter py> import os py> os.environ['TK_LIBRARY'] 'D:\\apps\\Python26\\tcl\\tk8.5' py> any(isinstance(value,unicode) for value in os.environ.values()) False This might be an ActiveState issue. |
|||
| msg94641 - (view) | Author: Tim Hatch (thatch) * | Date: 2009年10月28日 22:33 | |
I'm running the exact same version as Gabriel (on Windows 7, 32 bit) from the python.org installer, and have the same behavior as Michał. Checking FixTk.py it appears that on Vista and above, it calls the Win32 API GetFinalPathNameByHandleW to expand symbolic links, but this is a -W function, not a -A so it deals with unicode. The blame shows this function was added in response to #3881 For my system, the paths are all lower ascii so changing the end of convert_path to return str(s) works. I don't know anything about filesystem encodings on Windows to do a more correct conversion. |
|||
| msg95260 - (view) | Author: Gabriel Genellina (ggenellina) | Date: 2009年11月14日 22:06 | |
This patch may solve this issue, but I don't have a Vista install to test it. |
|||
| msg95272 - (view) | Author: Michał Pasternak (dotz) | Date: 2009年11月15日 02:17 | |
This patch works OK for me (Vista Home Premium + Python 2.6), thanks! |
|||
| msg95347 - (view) | Author: ivank (ivank) | Date: 2009年11月16日 14:53 | |
The bug on the Twisted side may be of interest: http://twistedmatrix.com/trac/ticket/3964 |
|||
| msg95355 - (view) | Author: Michał Pasternak (dotz) | Date: 2009年11月16日 17:34 | |
I hit that bug with Twisted too - I tried to use AMP: http://twistedmatrix.com/trac/ticket/3931 |
|||
| msg98666 - (view) | Author: Jon Foster (JonFoster) | Date: 2010年02月01日 15:46 | |
This bug also breaks code that uses the subprocess module, e.g.: env = os.environ.copy() env['MY_VARIABLE'] = 'MY_VAL' subprocess.Popen(... , env=env) Fails on Windows 7 with an error that the environment can only contain strings. The offending variables are TK_LIBRARY and TCL_LIBRARY, which have Unicode strings as their values. I'm using Python 2.6.2. (The subprocess module should probably be fixed to use CreateProcessW and handle Unicode, but that's a separate issue). |
|||
| msg100524 - (view) | Author: Florent Xicluna (flox) * (Python committer) | Date: 2010年03月06日 10:17 | |
confirmed on Win7 buildbot, when the tcl or tk test is run before test_wsgiref: ====================================================================== FAIL: test_simple_validation_error (test.test_wsgiref.IntegrationTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "D:\cygwin\home\db3l\buildarea\trunk.bolen-windows7\build\lib\test\test_wsgiref.py", line 159, in test_simple_validation_error "AssertionError: Headers (('Content-Type', 'text/plain')) must" AssertionError: "AssertionError: Environmental variable TCL_LIBRARY is not a string: <type 'unicode'> (value: u'D:\\\\cygwin\\\\home\\\\db3l\\\\buildarea\\\\trunk.bolen-windows7\\\\tcltk\\\\lib\\\\tcl8.5')" != "AssertionError: Headers (('Content-Type', 'text/plain')) must be of type list: <type 'tuple'>" http://www.python.org/dev/buildbot/all/builders/x86%20Windows7%20trunk/builds/171 This error was introduced with patch for #3881. |
|||
| msg100530 - (view) | Author: Florent Xicluna (flox) * (Python committer) | Date: 2010年03月06日 15:06 | |
Fixed with r78722 on trunk. Pending backport to 2.6. |
|||
| msg101857 - (view) | Author: Florent Xicluna (flox) * (Python committer) | Date: 2010年03月28日 08:31 | |
Ported to 2.6 with r79336 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:56:52 | admin | set | github: 51155 |
| 2010年03月28日 08:31:10 | flox | set | status: pending -> closed messages: + msg101857 |
| 2010年03月06日 15:06:31 | flox | set | status: open -> pending resolution: fixed messages: + msg100530 stage: needs patch -> resolved |
| 2010年03月06日 10:17:44 | flox | set | versions:
+ Python 2.7 nosy: + flox messages: + msg100524 keywords: + buildbot stage: test needed -> needs patch |
| 2010年02月01日 15:51:43 | brian.curtin | set | nosy:
+ brian.curtin priority: normal components: + Windows keywords: + needs review type: behavior stage: test needed |
| 2010年02月01日 15:46:15 | JonFoster | set | nosy:
+ JonFoster messages: + msg98666 |
| 2009年11月18日 16:16:14 | amaury.forgeotdarc | link | issue7344 superseder |
| 2009年11月16日 17:34:47 | dotz | set | messages: + msg95355 |
| 2009年11月16日 14:53:08 | ivank | set | nosy:
+ ivank messages: + msg95347 |
| 2009年11月16日 14:51:33 | srid | set | nosy:
+ srid |
| 2009年11月15日 02:17:54 | dotz | set | messages: + msg95272 |
| 2009年11月14日 22:06:29 | ggenellina | set | files:
+ FixTk.diff keywords: + patch messages: + msg95260 |
| 2009年10月28日 22:33:57 | thatch | set | nosy:
+ thatch messages: + msg94641 |
| 2009年09月16日 08:05:50 | ggenellina | set | nosy:
+ ggenellina messages: + msg92666 |
| 2009年09月14日 09:29:25 | dotz | create | |