Raspberry Pi auto water changer + ATO

This is what I added to the crontab file

Code:
@reboot python /home/pi/Water/Changer.py &

Its strange if in terminal I cd into my directory Water and then run 'python Changer.py' it runs without any problems, If I'm out of the Water directory and run at 'python /home/pi/Water/Changer.py' it throws up the statement
Code:
Traceback (most recent call last):
  File "/home/pi/Water/Changer.py", line 83, in <module>
    paper.Initial()
  File "/home/pi/Water/epaper.py", line 30, in Initial
    frame_black = epd.get_frame_buffer(Image.open('black1.bmp'))
  File "/usr/lib/python2.7/dist-packages/PIL/Image.py", line 2312, in open
    fp = builtins.open(filename, "rb")
IOError: [Errno 2] No such file or directory: 'black1.bmp'
but if I run 'sudo python /home/pi/Water/Changer.py' I get
Code:
Traceback (most recent call last):
  File "/home/pi/Water/Changer.py", line 5, in <module>
    import schedule
ImportError: No module named schedule

I can't figure out whats wrong?
Pip install schedule?
 
Pip install schedule?
In all honesty @Ranjib I cannot remember what I had done to sort it, the new program I'm writing I have been running in python3 as that's where the tutorials for flask have came from. once running I'll be looking at playing with the HTML files with bootstrap to add bits like server sent events and a better layout / more professional look but just mainly looking to get the system working. spent around 3 days on it so far with the new build that's in GitHub, a lot of trial and error to get parts to run.
 
In all honesty @Ranjib I cannot remember what I had done to sort it, the new program I'm writing I have been running in python3 as that's where the tutorials for flask have came from. once running I'll be looking at playing with the HTML files with bootstrap to add bits like server sent events and a better layout / more professional look but just mainly looking to get the system working. spent around 3 days on it so far with the new build that's in GitHub, a lot of trial and error to get parts to run.
So far im only running it in an open terminal SSH connection so may encounter a similar issue when looking to get the program to run on boot, for now I'm happy to get the code fully running and working and then babysteps from there.
 

IF YOU HAD TO TAKE A REEFING EXAM, WOULD YOU PASS?

  • Yes!

    Votes: 32 45.7%
  • Not yet, but I have one that I want to buy in mind!

    Votes: 9 12.9%
  • No.

    Votes: 26 37.1%
  • Other (please explain).

    Votes: 3 4.3%
Back
Top