From 8c4e8b5da7d0caa0ee88e3a11410e9b3f33551f6 2019-12-01 03:15:17 From: Matthias Bussonnier Date: 2019-12-01 03:15:17 Subject: [PATCH] Strange wondows regression --- diff --git a/IPython/utils/path.py b/IPython/utils/path.py index f2f1ea0..d52cad0 100644 --- a/IPython/utils/path.py +++ b/IPython/utils/path.py @@ -198,11 +198,12 @@ def get_home_dir(require_writable=False) -> str: # expanduser failed, use the registry to get the 'My Documents' folder. try: import winreg as wreg - with wreg.OpenKey( + key = wreg.OpenKey( wreg.HKEY_CURRENT_USER, r"Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" - ) as key: - homedir = wreg.QueryValueEx(key,'Personal')[0] + ) + homedir = wreg.QueryValueEx(key,'Personal')[0] + key.Close() except: pass