Relative Content

Tag Archive for pythontry-except

print exception message in try block

I’m trying to practise Try/Except. In my code below, my initial EOFError prints the message and breaks correctly. However, in the second try block if I enter an item that is not in the dictionary the message does not print, it just re-prompts for input.

python try except misuse – what should i use instead?

I’m working with an external API and trying to automatically feed data from it into my own application.
Let’s say that the API call i’m making always has the fields ‘length’ and ‘girth’ and sometimes has the field ‘colour’.