Hi Terry,

> def change_rings_2(channel):
>     global msg_subdir, chr_subdir, c_player

You can delete that global, just to make the test simpler still.

>     msg_file = 'Change_Rings_On.wav'
>     msg_path = os.path.join(msg_subdir, msg_file)
> 
> #    subprocess.call(['aplay', '--device=plughw:1,0', msg_path])
> #    time.sleep(2)
> 
>     print 'Message Played'
...
> If I uncomment the time.sleep() line, then it prints two.

Two `Message Played'?  Do they appear roughly together, both after a
two-second gap?  If you're not sure, increase the 2.

> If I uncomment the line that invokes the player, I get two lots of the
> 'Change_Rings_On.wav' message to the speaker.

In addition to the sleep, or instead of, or doesn't it matter?

There was some debounce option when registering the callback?  Are you
still using that and to a big enough time?  Are the callbacks defined to
be edge triggered, so on the switch's transition from off to on?

Cheers, Ralph.

-- 
Next meeting:  Bournemouth, Tuesday, 2017-04-04 20:00
Meets, Mailing list, IRC, LinkedIn, ...  http://dorset.lug.org.uk/
New thread:  mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING
Reporting bugs well:  http://goo.gl/4Xue     / TO THE LIST OR THE AUTHOR

Reply via email to