Usando un bloque de excepción genérico
#!/usr/bin/env python3
try:
with open('input.txt', 'r') as myfile:
for line in myfile:
print(line)
except FileNotFoundError:
print('Sorry, file doesn\'t exist or you don\'t have permission to access the file')
except Exception as error:
print(error)
print(type(error))
print('Outside the with block')
Shy Skunk