[LAD] Python assistance - threads (my favorite)

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <linux-audio-dev@...>
Date: Thursday, October 14, 2010 - 10:05 pm

Hi,

In a bit of a time crunch. Can anyone tell me how to do this properly?

I would like to have a threaded timer to run "cmd" after 5 seconds.
However cmd is normally triggered like this:

os.system(cmd)

But there seems to be an issue with calling os.system(cmd) from
subprocess.popen.

==========================

def do_popen(self, *args):
subprocess.Popen(args[0], shell=True)

def other function

cmd = 'spd-say -t female2 "' + audioText + '"'
args = shlex.split(cmd)

# Add 5 second delay for first view to allow existing speech processes to
finish
print "do_speech: ",delay
if delay:
print "do_speech: delayed start"
t = threading.Timer(5.0, self.do_popen(cmd))
t.start()
else :
print "do_speech: immediate start"
self.do_popen(cmd)

======================

FYI, it is for an accessibility wizard that Daniel and I have been working
on.

Cheers.

--
Patrick Shirkey
Boost Hardware Ltd.

"ZPE is not about creating something from nothing: It is about using the
zero point of a wave as a means to transform other forms of potential
energy like magnetic flux, heat, or particle spin into usable energy in
such a way that entropy appears to be reversed."

_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@lists.linuxaudio.org
http://lists.linuxaudio.org/listinfo/linux-audio-dev

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[LAD] Python assistance - threads (my favorite), Patrick Shirkey, (Thu Oct 14, 10:05 pm)
Re: [LAD] Python assistance - threads (my favorite), Dominic Sacré, (Fri Oct 15, 7:02 am)
Re: [LAD] Python assistance - threads (my favorite), Patrick Shirkey, (Fri Oct 15, 3:33 pm)
Re: [LAD] Python assistance - threads (my favorite), Niels Mayer, (Fri Oct 15, 4:44 pm)