0

I used the following command :

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

but I can't find the image.

Any suggestions?

5
  • does it work in the shell? Commented May 15, 2015 at 11:07
  • actually I'm new to python. can you be more specific? Commented May 15, 2015 at 11:24
  • try the command in the terminal Commented May 15, 2015 at 11:25
  • The > operator always creates a file, even when the command fails (the file is opened before the command is run). After executing os.system(...) you must have test.pnm inside your home directory. It might be empty, but it must be there. If it's not, it means that os.system(...) gets never called. Commented May 15, 2015 at 11:48
  • That's exactly the problem, I can't find the file even though the scanner did the scan ! and also when I use a location path (/home/test.pnm) it gives me an error : cannot find /root/home/test.pnm : Directory nonexistance Commented May 15, 2015 at 11:58

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you, it seems that ~ was the problem

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.