Changeset 4850
- Timestamp:
- Nov 22, 2007, 3:04:05 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/shallow_water/data_manager.py
r4824 r4850 5256 5256 5257 5257 def start_screen_catcher(dir_name, myid='', numprocs='', extra_info='', 5258 print_to_screen=False,verbose=False):5259 """ 5258 verbose=False): 5259 """ 5260 5260 Used to store screen output and errors to file, if run on multiple 5261 5261 processes eachprocessor will have its own output and error file. … … 5263 5263 extra_info - is used as a string that can identify outputs with another 5264 5264 string eg. '_other' 5265 5266 FIXME: Would be good if you could suppress all the screen output and 5267 only save it to file... however it seems a bit tricky as this caputure 5268 techique response to sys.stdout and by this time it is already printed out. 5269 5265 5270 """ 5266 5271 import sys 5267 5272 dir_name = dir_name 5268 5273 if access(dir_name,W_OK) == 0: 5269 if verbose: print 'Mak edirectory %s' %dir_name5270 if verbose: print "myid", myid5274 if verbose: print 'Making directory %s' %dir_name 5275 # if verbose: print "myid", myid 5271 5276 mkdir (dir_name,0777) 5272 5277 if myid <>'': … … 5282 5287 numprocs, 5283 5288 extra_info) 5284 print screen_output_name5289 if verbose: print screen_output_name 5285 5290 #used to catch screen output to file 5286 5291 sys.stdout = Screen_Catcher(screen_output_name) … … 5302 5307 fid = open(self.filename, 'a') 5303 5308 fid.write(stuff) 5304 # if print_to_screen: print stuff 5305 5306 def copy_code_files(dir_name, filename1, filename2): 5309 5310 def copy_code_files(dir_name, filename1, filename2=None): 5307 5311 """Copies "filename1" and "filename2" to "dir_name". Very useful for 5308 5312 information management … … 5314 5318 mkdir (dir_name,0777) 5315 5319 shutil.copy(filename1, dir_name + sep + basename(filename1)) 5316 shutil.copy(filename2, dir_name + sep + basename(filename2)) 5317 # copy (__file__, project.output_run_time_dir + basename(__file__)) 5318 print 'Files %s and %s copied' %(filename1, filename2) 5320 if filename2!=None: 5321 shutil.copy(filename2, dir_name + sep + basename(filename2)) 5322 print 'Files %s and %s copied' %(filename1, filename2) 5323 else: 5324 print 'File %s copied' %(filename1) 5319 5325 5320 5326 def get_data_from_file(filename,separator_value = ','):
Note: See TracChangeset
for help on using the changeset viewer.