GCode System Commands with gphoto2 does not work properly

Hi all,

I have been using GCode System Command to launch a shell script that executes gphoto2 in order to capture and download a picture from my camera. If I execute it in shell it triggers a picture and downloads it to my raspberry pi. But if it is executed by Octoprint through gcode it only partly executes.

If I execute it in shell it works without a problem which give me this:

New file is in location /capt0000.jpg on the camera
Saving file as /home/pi/pics_v1/04-12-22-42-27.jpg
Deleting file /capt0000.jpg on the camera

But if I let GCode System Command launch the exact same script I only get this:

New file is in location /capt0000.jpg on the camera

The downloading part is completely skipped. I have read about the PATH problem and I have included the whole path of the gphoto2 command, but still it is no downloading the picture. It looks like it just executes capture image but not the download part. Does the Gcode System Command stop too early?

Has anybody an idea what could fix this problem?

I just found the problem...

Instead of:

/usr/bin/gphoto2 --capture-image-and-download --filename "/home/pi/%m-%d-%H-%M-%S.%C"

Do this:

cd ~
/usr/bin/gphoto2 --capture-image-and-download --filename "%m-%d-%H-%M-%S.%C"

Somehow if the code is started from OctoPrint it has to go to the right folder first before launching gphoto2.

1 Like