+ check if sectors/sectors2 directories exist before attempting to read them

master
Nils Dagsson Moskopp 2011-06-02 17:21:58 +02:00
parent 5df1b218a4
commit eeebf632e8
1 changed files with 16 additions and 13 deletions

View File

@ -73,7 +73,8 @@ xlist = []
zlist = []
# List all sectors to memory and calculate the width and heigth of the resulting picture.
for filename in os.listdir(path + "sectors2"):
if os.path.exists(path + "sectors2"):
for filename in os.listdir(path + "sectors2"):
for filename2 in os.listdir(path + "sectors2/" + filename):
x = hex_to_int(filename)
z = hex_to_int(filename2)
@ -83,7 +84,9 @@ for filename in os.listdir(path + "sectors2"):
continue
xlist.append(x)
zlist.append(z)
for filename in os.listdir(path + "sectors"):
if os.path.exists(path + "sectors"):
for filename in os.listdir(path + "sectors"):
x = hex4_to_int(filename[:4])
z = hex4_to_int(filename[-4:])
if x < sector_xmin or x > sector_xmax: