0

I am running a simple program on the raspberrypi camera, 'raspistill' works in the command shell, however when it comes to program it on python, the simple script doesn't seem to take pictures for me, on the route of /home/pi/Desktop, there is no such a photo named abc.jpg

import time
import subprocess
import os

try:
    filename = 'abc'
    cmd = 'raspistill -o '+'/home/pi/Desktop/abc.jpg' \
                          +'-t 1000 ' \
                          +'-w 640 ' \
                          +'-h 480 ' \
                          +'-rot 0'
    subprocess.call(cmd, shell=True)
    time.sleep(4)
except KeyboardInterrup:
    print 'good bye'

There is no errors in running the script, so I don't know what is wrong with it

  • It would be great if you could provide us with the error messages you are getting. – Arne Oct 2 '13 at 9:15
  • sorry, Arne, there is no errors in running the script, so I don't figure out why there is no image, the cmd configuration is fine, looks everything is fine – user824624 Oct 2 '13 at 10:02
4

Maybe you need to provide the whole path to the raspistill program. You are assuming python knows where it is.

You are also missing a space after the file name and your command is resulting in:

raspistill -o /home/pi/Desktop/abc.jpg-t 1000 -w 640 -h 480 -rot 0

  • 1
    true, too stupid mistake. Next time, I will print the cmd out to debug, :) – user824624 Oct 2 '13 at 10:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.