On Wed, Apr 20, 2011 at 12:28 AM, David <da...@silveregg.co.jp> wrote:
> def _stop(arg): > reactor.stop() > d.addBoth(_stop) > Try using addCallbacks instead of addBoth. Then, you can logically separate code to handle/print errors from "normal" code. This will simply print no error in the log: > That's because you discarded the twisted.python.failure.Failure object by using _stop for your errback and not doing anything with the arg. Similar to try/except with a "pass" in the "except" clause. def log_error(failure): log.err(failure.printTraceback()) > return failure > d.addErrback(log_error) > d.addBoth(_stop) > Use d.addCallbacks(_stop, log_error) instead of addBoth/addErrback. Also, you probably want "log.err(failure.getTraceback())" instead of "log.err(failure.printTraceback())". printTraceback does not return a meaningful value IIUC. I don't get any traceback either. > Your traceback went to stdout whereas you were probably watching stderr or a log file. Jason -- Jason Rennie Research Scientist, ITA Software 617-714-2645 http://www.itasoftware.com/
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python