"env" parameter to "popen" won't accept Unicode on Windows - minor Unicode bug

John Nagle nagle at animats.com
Mon Jan 14 19:26:51 EST 2008


I passed a dict for the "env" variable to Popen with Unicode strings
for the dictionary values.

Got:

   File "D:\Python24\lib\subprocess.py", line 706, in _execute_child
		TypeError: environment can only contain strings

It turns out that the strings in the "env" parameter have to be ASCII,
not Unicode, even though Windows fully supports Unicode in CreateProcess.

				John Nagle



More information about the Python-list mailing list