Reputation: 858
The Error occurs only with the shell script after reboot!
The issue:
I am trying to run my python script on Startup in Raspberry Pi. So, I wrote a Shell script called launcher.sh
as follows:
#!/bin/sh
# launcher.sh
# navigate to the home directory, then to this directory, then execute python script, then back home
cd /
cd home/pi/myfile
python myfile.py &
cd /
After rebooting the Raspberry Pi, I get ValueError:numpy.ndarray size changed, may indicate binary incompatibility. Expected 48 from C header, got 40 from PyObject
in cronlog.
Solutions available:
This error is not new and lots of online resources are available 1,2,3, etc.I followed these links and installed pycocotools
and upgraded numpy
. I get no error when I run my python script in the terminal (python myfile.py
) and also when I run the shell script (sh launcher.sh
).
However, after I reboot the Raspberry Pi, the error occurs. What has happened here?
Upvotes: 4
Views: 5609
Reputation: 858
After a rigorous search, I got some hints from this accepted answer. I checked my cronlog file and followed the python import
attempt until the error had occurred. The error had occurred just after import Interval attempt. Therefore, I installed the numpy
as follows:
sudo pip install --upgrade numpy Interval
It solved my problem. Everything works fine after the reboot.
Upvotes: 2