On Mon, 10 Jul 2006 11:29:37 +0000, sreekant <[EMAIL PROTECTED]> wrote: >Hi folks > >What am I doing wrong in the following? I just want to run fluidsynth in >the background. >######################################### >class MyThread(threading.Thread): > def __init__(self, cmd, callback): > self.__cmd = cmd > self.__callback = callback > threading.Thread.__init__(self) > > def run(self): > os.system(self.__cmd) > self.__callback('abcd') > return > > >cmd=midiplay+' '+fmidi >xc=MyThread(cmd,addlog) >xc.start() >
You don't need threads to run another process "in the background". For example, here's how you would do it with Twisted: from twisted.internet import gtk2reactor gtk2reactor.install() from twisted.internet import reactor def main(): reactor.spawnProcess( None, '/usr/bin/fluidsynth', ['fluidsynth', '-ni', '/home/mysndfont.sf2', 'mymidi.mid']) reactor.run() Your Gtk app won't block and you won't have to worry about the threading/forking/signal interaction that is messing you up now. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list