Auto Starting a python script on boot (RPi) -
Auto Starting a python script on boot (RPi) -
i have python script on rpi needs run on boot
i added rc.local, , used work fine
a few days ago, added functionality program, , uses open() read txt file
now every time restart pi, python gives me , error:
file "home/pi/client.py", line 13, in <module> stats=open('stats.txt') ioerror: [errno 2] no such file or directory: 'stats.txt' when manually launch script with:
sudo python client.py it works fine no problems.
any suggestions?
your rc.local not start script in right directory. should either:
cd my/dir && python /path/to/home/pi/client.py call os.chdir("/path/to/some_dir") in script use absolute path when opening file: stats = open('/path/to/stats.txt') python python-2.7 raspberry-pi
Comments
Post a Comment