unboundlocal error

Sebastian Spaeth Sebastian at SSpaeth.de
Mon Sep 26 14:32:06 BST 2011

On Sat, 24 Sep 2011 00:20:44 -0400, Dave Abrahams <dave at boostpro.com> wrote:
> I think this one is pretty trivial; probably the try block starts one
> statement too early.
> UnboundLocalError: local variable 'localfolder' referenced before assignment

Fixed by below commit. However, this error is masking another
OfflineImapError that is bubbling up.

commit 041f553866a5f12fceea3544757fe0964104c986
Author: Sebastian Spaeth <Sebastian at SSpaeth.de>
Date:   Mon Sep 26 15:27:04 2011 +0200

Robustify error msg raising against more failure
When syncfolder() fails, we output an error message containing the
foldername per the 'localfolder' variable. However, the localfolder
variable is assigned inside our try: block and when the error occurs
there, we will have no localfolder variable to use for output. This
caused the errormsg to cause an Exception itself which unhelpfully
distracts from the root cause of the error.
Reconstruct the folder name in a bit more complex way, but in a way so
it is guaranteed to work (by relying on parameters passed in to the
Signed-off-by: Sebastian Spaeth <Sebastian at SSpaeth.de>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/offlineimap-project/attachments/20110926/aff00fa6/attachment-0001.sig>

More information about the OfflineIMAP-project mailing list