Browse Source

fixed genresult display bug

print was indented under indent is None
master
poikilos 9 years ago
committed by Jacob Gustafson
parent
commit
c412709cb8
  1. 24
      chunkymap-regen.py

24
chunkymap-regen.py

@ -66,32 +66,32 @@ def view_traceback():
traceback.print_tb(tb) traceback.print_tb(tb)
del tb del tb
def print_file(path, indent=""): def print_file(path, min_indent=""):
line_count = 0 line_count = 0
try: try:
if path is not None: if path is not None:
if os.path.isfile(path): if os.path.isfile(path):
if indent is None: if min_indent is None:
indent = "" min_indent = ""
ins = open(path, 'r') ins = open(path, 'r')
line = True line = True
while line: while line:
line = ins.readline() line = ins.readline()
line_count += 1 line_count += 1
if line: if line:
print(indent+line) print(min_indent+line)
ins.close() ins.close()
#if line_count==0: #if line_count==0:
#print(indent+"print_file WARNING: "+str(line_count)+" line(s) in '"+path+"'") #print(min_indent+"print_file WARNING: "+str(line_count)+" line(s) in '"+path+"'")
#else: #else:
#print(indent+"# "+str(line_count)+" line(s) in '"+path+"'") #print(min_indent+"# "+str(line_count)+" line(s) in '"+path+"'")
else: else:
print (indent+"print_file: file does not exist") print (min_indent+"print_file: file does not exist")
else: else:
print (indent+"print_file: path is None") print (min_indent+"print_file: path is None")
except: except:
print(indent+"print_file: could not finish") print(min_indent+"print_file: could not finish")
try: try:
ins.close() ins.close()
except: except:
@ -825,10 +825,10 @@ class MTChunks:
print (min_indent+"WARNING: no chunk data though traversed by player:") print (min_indent+"WARNING: no chunk data though traversed by player:")
print(min_indent+"standard output stream:") print(min_indent+"standard output stream:")
line_count = print_file(genresult_path, min_indent+" ") line_count = print_file(genresult_path, min_indent+" ")
if line_count>0: #if line_count>0:
#print(min_indent+" #EOF: "+str(line_count)+" line(s) in '"+genresult_path+"'") #print(min_indent+" #EOF: "+str(line_count)+" line(s) in '"+genresult_path+"'")
pass # pass
else: #else:
print(min_indent+" #EOF: "+str(line_count)+" line(s) in '"+genresult_path+"'") print(min_indent+" #EOF: "+str(line_count)+" line(s) in '"+genresult_path+"'")
subprocess.call(cmd_no_out_string+" 2> \""+genresult_path+"\"", shell=True) subprocess.call(cmd_no_out_string+" 2> \""+genresult_path+"\"", shell=True)
print(min_indent+"standard error stream:") print(min_indent+"standard error stream:")

Loading…
Cancel
Save