<div class="gmail_quote">On Wed, Apr 20, 2011 at 12:28 AM, David <span dir="ltr">&lt;<a href="mailto:david@silveregg.co.jp">david@silveregg.co.jp</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
    def _stop(arg):<br>
         reactor.stop()<br>
     d.addBoth(_stop)<br></blockquote><div><br></div><div>Try using addCallbacks instead of addBoth.  Then, you can logically separate code to handle/print errors from &quot;normal&quot; code.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
This will simply print no error in the log:<br></blockquote><div><br></div><div>That&#39;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 &quot;pass&quot; in the &quot;except&quot; clause.</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">    def log_error(failure):</blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

         log.err(failure.printTraceback())<br>
         return failure<br>
     d.addErrback(log_error)<br>
     d.addBoth(_stop)<br></blockquote><div><br></div><div>Use d.addCallbacks(_stop, log_error) instead of addBoth/addErrback.  Also, you probably want &quot;log.err(failure.getTraceback())&quot; instead of &quot;log.err(failure.printTraceback())&quot;.  printTraceback does not return a meaningful value IIUC.</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">I don&#39;t get any traceback either.<br></blockquote><div><br></div><div>Your traceback went to stdout whereas you were probably watching stderr or a log file.</div>
<div><br></div><div>Jason</div></div><br>-- <br>Jason Rennie<br>Research Scientist, ITA Software<br>617-714-2645<br><a href="http://www.itasoftware.com/">http://www.itasoftware.com/</a><br><br>