User avatar
Posts: 151
Joined: Sat May 09, 2015 7:50 am
Location: Wimborne, Dorset, UK

Python Script Only Works in IDLE

Sun Mar 26, 2017 12:10 pm


I have a small Python script that I need to run headless. It's function is to sound the bells at fixed times of the day (eg, church chimes in a model town) and also to play music and other sounds to order. The chimes are triggered by function calls in apscheduler entries and the music and other sounds are triggered using RPi.GPIO.add_event_detect() entries, where the events are triggered by the user depressing a switch.

This all works perfectly in IDLE. The apscheduler and RPi.GPIO statements are all setup on startup and then the script sits there doing nothing until the user triggers an event or the time to ring the bells comes round. Afterwards the script idles until the next event. Very gratifying :)

The problem comes when I try to launch it from the shell on boot-up (or by direct invocation). The script runs OK, but it looks as though it then exits instead of idling as it does in IDLE (excuse the pun). Is this expected behaviour? If so, is there a way round it?

Posts: 7983
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Python Script Only Works in IDLE

Sun Mar 26, 2017 12:50 pm

Might be helpful if you posted your script then we could look to see why it might not be looping.
Please use code tags when posting python code.
We want information… information… information no help
The use of crystal balls & mind reading are not supported

Return to “Python”