Issue with running opencv program using a script

Hello!
The jetson runs a dual camera program (imx219) using threading.
Example code - CSI-Camera/dual_camera.py at master · JetsonHacksNano/CSI-Camera · GitHub

It runs perfectly fine on vscode, but when I try to run it through a script I get an error which says it can’t identify the cameras.
Where the line174 in the error msg is equivalent to line 162 on the github code.

Traceback (most recent call last):
  File "/home/user1/record_dual_cam_noimshow.py", line 239, in <module>
    run_cameras()
  File "/home/user1/record_dual_cam_noimshow.py", line 174, in run_cameras
    success , left_image = left_camera.read() #ISSUE HERE 
  File "/path/to/record_dual_cam_noimshow.py", line 85, in read
    frame = self.frame.copy()
AttributeError: 'NoneType' object has no attribute 'copy'

This is what my script file (mything.sh) looks like in /usr/local/bin

#!/bin/bash
#!/usr/bin/env python3

python3 /home/user1/record_dual_cam_noimshow.py

I also have a service file to autorun it in in /etc/systemd/system as mything.service

[Unit]
Description=mything: do my own thing
After=multi-user.target

[Service]
ExecStart=/usr/local/bin/mything.sh
StartLimitInterval=10
RestartSec=10

[Install]
WantedBy=multi-user.target

The autorun script itself works with a simple print current time program but not the opencv which is due to the system not finding the cameras which is where I am mainly stuck at.

Sorry for the late response, have you managed to get issue resolved or still need the support? Thanks

Please break into the python code to figure it out.

Thanks

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.