【发布时间】:2012-04-14 00:37:14
【问题描述】:
我想打开一个 unicode 文件名。 以下代码:
cmd = u'cmd /c "C:\\Pok\xe9mon.mp3"'
cmd = cmd.encode('utf-8')
subprocess.Popen(cmd)
返回
>>> 'C:\Pokיmon.mp3' is not recognized as an internal or external command, operable program or batch file.
即使该文件确实存在。为什么会这样?
【问题讨论】:
-
我认为 'cmd' 代表别的东西?
-
我删除了双引号,即使它们与问题无关。
-
您是否已将 python 路径包含在您的 PATH 环境变量中?假设你的 Python 安装在 C:\Python25 中,你的新路径变量应该是:%PATH%;C:\Python25
-
是的,但
PATH与什么有什么关系?
标签: python windows unicode command-line subprocess