From 7b8eff6efd8365816fa369dfd9c9d2572fb6ed60 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 5 Mar 2015 12:38:53 +0530 Subject: [PATCH] Avoid exceptions during auto-close of registry keys --- src/calibre/utils/winreg/lib.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/utils/winreg/lib.py b/src/calibre/utils/winreg/lib.py index 0a23ad4ac8..d8cc21f216 100644 --- a/src/calibre/utils/winreg/lib.py +++ b/src/calibre/utils/winreg/lib.py @@ -263,7 +263,7 @@ class Key(object): return bool(self.hkey) def close(self): - if not self.hkey: + if not getattr(self, 'hkey', None): return if RegCloseKey is None or HKEY is None: return # globals become None during exit