Wednesday, 7 March 2018

json - Python won't handle simple exception

It just wont go into the except block, instead it states there is not such file or directory.. shouldn't it enter in the except block if I get an IOError? what am I missing?




try:
file_users = open ('datos/usuarios.json','r')
dic = json.load(file_users)
file_users.close()
except EOFError, IOError:
print("File does not exist")

No comments:

Post a Comment

casting - Why wasn't Tobey Maguire in The Amazing Spider-Man? - Movies & TV

In the Spider-Man franchise, Tobey Maguire is an outstanding performer as a Spider-Man and also reprised his role in the sequels Spider-Man...