From d5b935cf96ac49dc2e8f9c7484cd65cf53e459ea Mon Sep 17 00:00:00 2001 From: poikilos <7557867+poikilos@users.noreply.github.com> Date: Thu, 3 Mar 2016 11:07:18 -0500 Subject: [PATCH] debugging use of new chunk object --- chunkymap-regen.py | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/chunkymap-regen.py b/chunkymap-regen.py index a77b493..3c17290 100644 --- a/chunkymap-regen.py +++ b/chunkymap-regen.py @@ -803,6 +803,8 @@ class MTChunks: if os.path.isfile(tmp_png_path): os.remove(tmp_png_path) subprocess.call(cmd_string, shell=True) # TODO: remember not to allow arbitrary command execution, which could happen if input contains ';' when using shell=True + + self.prepare_chunk_meta(chunk_luid) # DOES load existing yml if exists this_chunk = self.chunks[chunk_luid] if os.path.isfile(tmp_png_path): result = True @@ -825,19 +827,23 @@ class MTChunks: print (min_indent+"WARNING: no chunk data though traversed by player:") print(min_indent+"standard output stream:") line_count = print_file(genresult_path, min_indent+" ") - #if line_count>0: - #print(min_indent+" #EOF: "+str(line_count)+" line(s) in '"+genresult_path+"'") - # pass - #else: - print(min_indent+" #EOF: "+str(line_count)+" line(s) in '"+genresult_path+"'") - subprocess.call(cmd_no_out_string+" 2> \""+genresult_path+"\"", shell=True) - print(min_indent+"standard error stream:") - line_count = print_file(genresult_path, min_indent+" ") - if (line_count<1): + if line_count>0: + print(min_indent+" #EOF: "+str(line_count)+" line(s) in '"+genresult_path+"'") + pass + else: print(min_indent+" #EOF: "+str(line_count)+" line(s) in '"+genresult_path+"'") - print(min_indent+" (done output of '"+cmd_no_out_string+"')") + subprocess.call(cmd_no_out_string+" 2> \""+genresult_path+"\"", shell=True) + print(min_indent+"standard error stream:") + line_count = print_file(genresult_path, min_indent+" ") + if (line_count<1): + print(min_indent+" #EOF: "+str(line_count)+" line(s) in '"+genresult_path+"'") + print(min_indent+" (done output of '"+cmd_no_out_string+"')") + try: + if os.path.exists(tmp_png_path): + os.rename(tmp_png_path, dest_png_path) + except: + pass try: - self.prepare_chunk_meta(chunk_luid) # DOES load existing yml if exists #this_chunk = MTChunk() #this_chunk.luid = chunk_luid