I think stranac's answer is what you want, but in case it isn't, note that the error won't be displayed but because you didn't catch the exception, the program will crash.
Due to the reasons discussed here
we will be moving to python-forum.io
on October 1, 2016.
This forum will be locked down and no one will be able to post/edit/create threads, etc. here from thereafter. Please create an account at the new site to continue discussion.