[Tutor] Working with error messages

Alan Gilfoy agilfoy at frontiernet.net
Sun May 6 16:28:28 CEST 2007


I have a number-to-Roman numeral program that churns out ValueError  
messages with a few improper input cases:

1. not an integer
2. larger than 3999
3. smaller than 0

When I run the program via IDLE, and I give one of these improper  
inputs, the interpreter closes down the program and then displays the  
appropriate ValueError message.

I would like the appropriate ValueError message to be displayed before  
the program shuts down, or at least a generic ValueError message.

Is looking at my specific pieces of code necessary to help with this?

I want this because if the program's being run as an application, the  
application window closes down as soon as the program closes, and the  
user doesn't get to see the message. [When I doubleclick on the .py  
file in Windows Explorer, it runs as a .exe, for example.]
-- 
"Computers were the first God-Satan collaboration project."
"Blind faith in bad leadership is not patriotism."

"One of the most horrible features of war is that all the war-propaganda, all
the screaming and lies and hatred, comes invariably from people who are not
fighting."-George Orwell, _Homage to Catalonia







More information about the Tutor mailing list