File system error handling in Python
The error handler in the case of a file not being found:
try:
with open('filename.txt', 'r') as file:
contents = file.readlines()
for line in lines:
print(line)
except FileNotFoundError as err:
print("File does not exist")
print(err)