Ibraheem Darawshi
Ibraheem Darawshi

Reputation: 13

Python: os.system() redirecting stdout to file in home directory fails

I used the following command :

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

but I can't find the image.

Any suggestions?

Upvotes: 0

Views: 119

Answers (1)

Mikko Ohtamaa
Mikko Ohtamaa

Reputation: 83488

Maybe ~ is not expanded. Try

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

and

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

Or if you are running as a different UNIX user (root) the home is not what you expect.

Upvotes: 1

Related Questions