DSLR Camera cannot download image to Raspberry Pi

I am trying to make a plugin using gphoto2 to make the printer stop per completion of a layer and then use --capture-image-and-download to download the image to Raspberry Pi. The camera did take pictures but no image was downloaded.

subprocess.call(["gphoto2","--force-overwrite","--capture-image-and-download","--filename","/home/pi/.octoprint/plugins/testim.jpg"])

I am using a hook to find out if a layer is completed, then I capture images and download within the hook. Please help me find out the reason why it was not downloading and thank you!!!

1 Like

Thanks everyone! I just figured out that I just need to change the save location using os.chdir before subprocess.

a hint, it's easier to make a shell script that capture the image, call gphoto2 from the script .. something like

#!/bin/sh

cd ~pi/layerimages/
gphoto2 --capture-image-and-download --filename "%Y%m%d%H%M%S.jpg"

and then from plugin just call the script