Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Jul 22, 2023. It is now read-only.
/pythonnetPublic archive
forked frompythonnet/pythonnet

Commitc9a784b

Browse files
rico-chettonyroberts
authored andcommitted
fix hkey cleanup
fix for AttributeError: 'NoneType' object has no attribute 'Close', full Traceback (most recent call last): File "<string>", line 1, in <module> File "C:\Users\foo\AppData\Local\Temp\pip-clrr6blj-build\setup.py", line 99, in <module> _xbuild = "\"%s\"" % _find_msbuild_tool("msbuild.exe") File "C:\Users\foo\AppData\Local\Temp\pip-clrr6blj-build\setup.py", line 77, in _find_msbuild_tool hkey.Close() AttributeError: 'NoneType' object has no attribute 'Close'
1 parent990170e commitc9a784b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

‎setup.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ def _find_msbuild_tool(tool="msbuild.exe", use_windows_sdk=False):
6464
paths_to_check= []
6565
hreg=_winreg.ConnectRegistry(None,_winreg.HKEY_LOCAL_MACHINE)
6666
try:
67-
hkey=None
6867
forkey_to_checkinkeys_to_check:
6968
sdk_name,key,value_name=key_to_check[:3]
7069
suffix=key_to_check[3]iflen(key_to_check)>3elseNone
70+
hkey=None
7171
try:
7272
hkey=_winreg.OpenKey(hreg,key)
7373
val,type_=_winreg.QueryValueEx(hkey,value_name)
@@ -79,7 +79,8 @@ def _find_msbuild_tool(tool="msbuild.exe", use_windows_sdk=False):
7979
exceptWindowsError:
8080
pass
8181
finally:
82-
hkey.Close()
82+
ifhkey:
83+
hkey.Close()
8384
finally:
8485
hreg.Close()
8586

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp