Python:os.system()将stdout重定向到主目录中的文件失败

时间:2015-05-15 09:47:31

标签: python image scanning os.system

我使用了以下命令:

os.system('scanimage > ~/test.pnm')

但我找不到图像。

有什么建议吗?

1 个答案:

答案 0 :(得分:1)

也许〜没有扩大。尝试

 os.system("scanimage > $HOME/test.pnm")

 os.system("scanimage > /tmp/test.pnm")

或者,如果您作为不同的UNIX用户(root)运行,则主页不是您所期望的。