1

I have a simple GPIO python script which is working correctly when F5'd from the IDLE3 IDE.

I've followed some instructions to add this to /etc/profile but it is not starting:

sudo python /home/pi/Documents/ScreamerPIR.py &

I have used this approach in the past and my scripts have started just fine.

  • What might stop a particular script starting? (this one uses pygame, whereas my previous scripts did not - could this be it?)
  • What approaches can I use to debug my problem?
  • Is there a log file anywhere?
4
  • Does it work if you type sudo python /home/pi/Documents/ScreamerPIR.py & from the command line?
    – joan
    Oct 31, 2016 at 9:01
  • Did you check the filename case sensitivity ? Unlike Windows Linux is case sensitive. General warnings and errors logger can be viewed using dmseg . Larger list of available logs are here Oct 31, 2016 at 23:01
  • Thanks both. Calling the script from the Terminal allowed me to see the errors and identify the problem (the path to a Wav file was not relative). Thanks @Joan - if you want to add an answer I'll mark it as correct. Nov 1, 2016 at 11:13
  • @MarkCooper It's better if you answer the question yourself especially as the steps you took to pinpoint the problem may be relevant.
    – joan
    Nov 1, 2016 at 11:18

1 Answer 1

1

Thanks to @joan for the steer..

Calling the command from the terminal shows the error message that was the cause of my problem.

sudo python /home/pi/Documents/ScreamerPIR.py &

Which in my case was a relative path to a wav file - the relative path works from IDLE IDE, but but when executed from /etc/profile

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.