阅读背景:

如果“env”参数包含unicode对象,为什么弹出窗口会失败?

来源:互联网 

Consider this example:

考虑一下这个例子:

>>> import subprocess as sp
>>> sp.Popen("notepad2.exe",env={"PATH":"C:\users\guillermo\smallapps\bin"})
<subprocess.Popen object at 0x030DF430>
>>> sp.Popen("notepad2.exe",env={"PATH":u"C:\users\guillermo\smallapps\bin"})
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python26\lib\subprocess.py", line 633, in __init__
    errread, errwrite)
 File "C:\Python26\lib\subprocess.py", line 842, in _execute_child
   startupinfo)
TypeError: environment can only contain strings
>>> import



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: