【发布时间】:2014-08-09 06:51:20
【问题描述】:
可能这个问题很明显,请原谅。
我想执行 shell 命令(Windows 8.1、Python 3.4)来打开带有 SVG 文件的 IE。 我是这样做的:
# imgpath = 'C:/Users/Vladimir/dot-code\\..\\graph1.svg'
tmp = FS.abspath(imgpath)
# tmp = 'C:\\Users\\Vladimir\\graph1.svg'
subprocess.call(["start", "", tmp])
看起来不错,但我在 call() 中遇到异常 - FileNotFoundError: [WinError 2] File not found.
我想罪恶的根源是“tmp”中的双斜线。我该如何解决?
【问题讨论】:
-
为什么您的 imgpath 与您的 tmp 路径不同?
-
我使用 GraphViz 生成图像。点代码位于“C:/Users/Vladimir/dot-code/graph1.dot”中。我将生成的图像保存在上一个目录中。
标签: python python-3.x cmd window python-3.4