threadutil: Don't require the StringIO module
The only reason we used it here was to do a traceback.print_exc(StringIO()) to get a string of our traceback. But we can simply use traceback.format_exc() which exists since python 2.4. One less module (and it is in the way to python 3 compatability too) Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de> Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
parent
b94bf79258
commit
10024731e6
@ -17,7 +17,6 @@
|
|||||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
from threading import *
|
from threading import *
|
||||||
from StringIO import StringIO
|
|
||||||
from Queue import Queue, Empty
|
from Queue import Queue, Empty
|
||||||
import sys, traceback, thread, time
|
import sys, traceback, thread, time
|
||||||
from offlineimap.ui import getglobalui
|
from offlineimap.ui import getglobalui
|
||||||
@ -173,9 +172,8 @@ class ExitNotifyThread(Thread):
|
|||||||
self.setExitCause('EXCEPTION')
|
self.setExitCause('EXCEPTION')
|
||||||
if sys:
|
if sys:
|
||||||
self.setExitException(sys.exc_info()[1])
|
self.setExitException(sys.exc_info()[1])
|
||||||
sbuf = StringIO()
|
tb = traceback.format_exc()
|
||||||
traceback.print_exc(file = sbuf)
|
self.setExitStackTrace(tb)
|
||||||
self.setExitStackTrace(sbuf.getvalue())
|
|
||||||
else:
|
else:
|
||||||
self.setExitCause('NORMAL')
|
self.setExitCause('NORMAL')
|
||||||
if not hasattr(self, 'exitmessage'):
|
if not hasattr(self, 'exitmessage'):
|
||||||
|
Loading…
Reference in New Issue
Block a user