Picamera2 Does not work in Crontab

Where did you get the camera module(s)?
From you

Model number of the product(s)?
64mp arducam

What hardware/platform were you working on?

Instructions you have followed. (link/manual/etc.)
manual and then troubleshooting the forum

Problems you were having?

Being able to use Picamera2 in Crontab

The dmesg log from your hardware?

Troubleshooting attempts you’ve made?

calling libcamera-still from a call to the command line

What help do you need?

Hi! I got our 64mp arducam working with a RPI 4, and I can write python code and use picamera2 and take photos and set focus and stuff and that’s working ok when I run the python file from the command line or Thonny or Geany.

but when I try to have the same script run from Crontab it won’t start. When i look at the output it will say something like “cannot find camera”

I ended up doing a workaround where instead of calling picamera2, i ended up doing calls to the cmd line from Python, but found I had to write the call like:

cmd = "/usr/local/bin/libcamera-still -o "+filename

Instead of normally just writing:
cmd = "libcamera-still -o "+filename

I guess crontab uses a different path or something to get to the things like libcamera still, and i got this path from running the command line:

[email protected]:~ $ which libcamera-still

is there something i need to do in my python code like with the imports?

from picamera2 import Picamera2

Can you access the camera by libcamera command?

1 Like

yes i can, and that’s how i hacked it right now, but it goes slower than when i call picamera2 in python