python - cherrypy thread does not spawn subprocess -


i having cherrypy application calls subprocess (subprocess.popen), works fine of time not work. when restart server, subprocess.popen called , works fine. there way monitor threads in cherrypy , check why subprocess.popen not called.

update: thread continues rest part of code , response, problem subprocess not called

sample code

def fn_test(self,**args):     #return args['md5'].split()[0]     final_html="the complete html"     in ['ab','cd','ef']:          if args.has_key(i):             cherrypy.session[i]='checked'         else:              cherrypy.session[i]=''        subprocess.popen(["python","test.py",'test','aval','bval'])     return final_html 

for simple , occasional background tasks recommend cherrypy.process.plugins.backgroundtask. take @ this question complete example , other general consideration background tasks.

specifically, treating subprocess issue, make sure can reason background code's correctness. @ least make several logging entries on start, stop , optionally before/after significant state changes in module. debugging propose replace command simple guaranteed bug-free. example, date >> date.log. it'll clear whether issue originates background module's flaw or process spawning issue.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -