Update pwrball.py - handle excpetion when avoid.cvs file does not exist.

This commit is contained in:
cpan 2022-11-03 11:34:55 -07:00
parent a5efb9a553
commit b3b7c15fc2

View File

@ -35,6 +35,8 @@ def main():
logging.basicConfig(level=logging.INFO, format = "[%(levelname)s] (%(threadName)-10s) %(message)s",) logging.basicConfig(level=logging.INFO, format = "[%(levelname)s] (%(threadName)-10s) %(message)s",)
avoid = [] avoid = []
try:
with open("avoid.csv", "r") as f: with open("avoid.csv", "r") as f:
reader = csv.reader(f) reader = csv.reader(f)
for row in reader: for row in reader:
@ -42,6 +44,8 @@ def main():
for num in row: for num in row:
introw.append(int(num)) introw.append(int(num))
avoid.append(introw) avoid.append(introw)
except FileNotFoundError:
pass
for item in avoid: for item in avoid:
logging.debug("before: %s", item) logging.debug("before: %s", item)