Browse Source

error handling for showing genresult

master
poikilos 9 years ago
committed by Jacob Gustafson
parent
commit
c122a88f64
  1. 29
      chunkymap-regen.py

29
chunkymap-regen.py

@ -68,18 +68,25 @@ def view_traceback():
def print_file(path, indent=""): def print_file(path, indent=""):
try: try:
if os.path.isfile(path): if path is not None:
if indent is None: if os.path.isfile(path):
indent = "" line_count = 0
ins = open(path, 'r') if indent is None:
line = True indent = ""
while line: ins = open(path, 'r')
line = ins.readline() line = True
if line: while line:
print(indent+line) line = ins.readline()
ins.close() line_count += 1
if line:
print(indent+line)
ins.close()
if line_count==0:
print(indent+"print_file WARNING: "+str(line_count)+" line(s) in '"+path+"'")
else:
print (indent+"print_file: file does not exist")
else: else:
print (indent+"print_file: missing path") print (indent+"print_file: path is None")
except: except:
print(indent+"print_file: could not finish") print(indent+"print_file: could not finish")

Loading…
Cancel
Save