threading troubles

sreekant skodela at lithium.com
Mon Jul 10 07:29:37 EDT 2006


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()


######################
midiplay is 'fluidsynth -ni /home/mysndfont.sf2 mymidi.mid'
addlog is a function which prints the log.

If I run it only with xc.start() it does not run the program as in 
os.system. However if I  put
xc.start()
xc.run()

then it starts and runs it in foreground with my pygtk ui non responsive.

What am I missing!

Thanks for any ideas
sree



More information about the Python-list mailing list