18 Jul
2005
18 Jul
'05
7:29 a.m.
Astan Chee wrote:
def getPassword(self): global RETRIES if RETRIES == 0: RETRIES = 1 return defer.succeed(PASSWORD) else: sys.exit(0)
But it keeps on giving this error: Yes, that's what sys.exit does, raise a SystemExit exception.
If you actually want a non-zero exit status, you need to reactor.stop and save your exit status somewhere, e.g. exitstatus=0 def thing(): global exitstatus if fail: exitstatus = 1 reactor.stop() reactor.run() # We'll only get here once reactor.stop is called sys.exit(exitstatus) A trivial bit of thought can solve this more elegantly than a global (gak!)