I have written a python script that runs successfully on raspberry pi if it is run manually from the console. As I want to start the script on reboot, I've written a bash script to change directory, set up the environment and run the python script. Upon checking the log, however, I have noticed that an error occurs when trying to import a library. Upon executing the following line:
from openvino.inference_engine import IENetwork, IEPlugin
an error is thrown:
Traceback (most recent call last): File "realtime_objectdetection_and_tracking_async.py", line 23, in <module> from custom_module... ImportError: No module named 'openvino.inference_engine'
If I run the same line from the console, there is no error:
pi@raspberrypi:~/workspace/counting-cars-with-backend-conn $ python3 Python 3.5.3 (default, Sep 27 2018, 17:25:39) [GCC 6.3.0 20170516] on linux Type "help", "copyright", "credits" or "license" for more information. >>> from openvino.inference_engine import IENetwork, IEPlugin
Therefore, as OpenVINO installation added to .bashrc the following line:
# OpenVINO source ~/inference_engine_vpu_arm/bin/setupvars.sh
I tried to do the same in the startup script before running the python script:
#!/bin/bash source /home/pi/inference_engine_vpu_arm/bin/setupvars.sh cd /home/pi/workspace/counting-cars-with-backend-conn python3 realtime_objectdetection_and_tracking_async.py &
Then I added the script to cron table by running crontab -e:
@reboot sh /home/pi/run_object_detection_and_tracking.sh
As this doesn't fix the issue (ImportError above), I don't know what should be additionally configured/modified in order to get the same behaviour as in the case of running the python script from the console.