[Tutor] system call

John washakie at gmail.com
Sun Oct 28 11:30:43 CET 2007


Here is my actual code (a section of a long script):

if os.path.isdir(ad) and aRun.split('_')[0]==STN_id[i] and in (aRun.split
('_')[1]):
   make_pages=os.path.join(BASEDIR,STN_id[i],SUBDIR[1],'make_pages')
   sedstr1="""cat %s | sed -e 's/ASYSmin=[0-9][0-9]*/ASYSmin=%s/g' > jnk"""
% (make_webpages,nf+1)
   sedstr2="""cat jnk | sed -e 's/ASYSmax=[0-9][0-9]*/ASYSmax=%s/g' > %s"""
% (nf+1,make_pages)
   cmd="""%s > %s """ % (make_pages,STN_id[i]+'.mw.out')
   print """ Now running make_pages for: %s """ % (files[nf])
   os.system(sedstr1)
   os.system(sedstr2)
   fail= os.system(cmd)
   print(cmd)
   if fail: print """For %s there was an error""" % (files[i])
   os.wait()
   print """Finished for %s """ % (files[i])
   raw_input('Continue?')

make_pages is  a shell script which usually is run with nohup and takes
anywhere from 1-24 hours to run, depending on ASYSmin, ASYSmax. If there the
same (which they are here) then it should take around one hour.

Perphaps I need to change the os.wait somehow? Or structure the
os.systemcall for cmd a little differently???

Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20071028/379d6560/attachment.htm 


More information about the Tutor mailing list