|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
sys.exit problem
Ok so here is my problem I have this code segment of code
if opera =="/": if (temp1 == "0"): print "Error going to bail" self.error() return (int(temp2) // int(temp1)) this works fine, when temp1=="0" it goes to the error function however def error(self): print "error" sys.exit(-1) also appears to be working, it prints out error, but then for whatever reason it continues to execute I get errors from code after it should have exited. Anyone have ideas why? I do have some of this code in a recursive function, does sys.exit not work with recurrsion? |
|
#2
|
||||
|
||||
|
Any finally statements in your program?
From the manual re: sys.exit() : "is implemented by raising the SystemExit exception, so cleanup actions specified by finally clauses of try statements are honored, and it is possible to intercept the exit attempt at an outer level. " Also if you have used atexit (see the manual) - the exit process can be modified. Grim
__________________
*** Experimental Python Markup CGI V2 *** |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Python Programming > sys.exit problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|