[PATCH 1/4] Re: Don't use CStringIO to format a traceback

Nicolas Sebrecht nicolas.s-dev at laposte.net
Thu Jun 16 17:41:34 BST 2011


On Tue, Jun 14, 2011 at 10:23:39AM +0200, Sebastian Spaeth wrote:
> 
> The traceback module has format_exc() for this purpose so let's use that.
> 
> Signed-off-by: Sebastian Spaeth <Sebastian at SSpaeth.de>
> ---
>  offlineimap/ui/UIBase.py |    7 ++-----
>  1 files changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/offlineimap/ui/UIBase.py b/offlineimap/ui/UIBase.py
> index 4c60b2a..5524579 100644
> --- a/offlineimap/ui/UIBase.py
> +++ b/offlineimap/ui/UIBase.py
> @@ -21,7 +21,6 @@ import time
>  import sys
>  import traceback
>  import threading
> -from StringIO import StringIO
>  import offlineimap
>  
>  debugtypes = {'':'Other offlineimap related sync messages',
> @@ -309,10 +308,8 @@ class UIBase:
>          s.terminate(100)
>  
>      def getMainExceptionString(s):
> -        sbuf = StringIO()
> -        traceback.print_exc(file = sbuf)
> -        return "Main program terminated with exception:\n" + \
> -               sbuf.getvalue() + "\n" + \
> +        return "Main program terminated with exception:\n%s\n" %\
> +               traceback.format_exc() + \
>                 s.getThreadDebugLog(threading.currentThread())

Doesn't it need

  + "\n"

like before?

-- 
Nicolas Sebrecht




More information about the OfflineIMAP-project mailing list