scripts/create_windows_links.py

branch
eric7
changeset 9482
a2bc06a54d9d
parent 9473
3f23dbf37dbe
child 9500
5771348ded12
equal deleted inserted replaced
9481:0b936ff1bbb9 9482:a2bc06a54d9d
10 """ 10 """
11 11
12 import contextlib 12 import contextlib
13 import os 13 import os
14 import sys 14 import sys
15
16 try:
17 import winreg
18 except ImportError:
19 print("This script is to be used on Windows platforms only. Aborting...")
20 sys.exit(1)
15 21
16 from eric7.Globals import getConfig 22 from eric7.Globals import getConfig
17 23
18 24
19 def main(argv): 25 def main(argv):
67 @param path registry path of the variable 73 @param path registry path of the variable
68 @type str 74 @type str
69 @return value of requested registry variable 75 @return value of requested registry variable
70 @rtype any 76 @rtype any
71 """ 77 """
72 try:
73 import winreg
74 except ImportError:
75 return None
76
77 try: 78 try:
78 registryKey = winreg.OpenKey(winreg.HKEY_CURRENT_USER, path, 0, winreg.KEY_READ) 79 registryKey = winreg.OpenKey(winreg.HKEY_CURRENT_USER, path, 0, winreg.KEY_READ)
79 value, _ = winreg.QueryValueEx(registryKey, name) 80 value, _ = winreg.QueryValueEx(registryKey, name)
80 winreg.CloseKey(registryKey) 81 winreg.CloseKey(registryKey)
81 return value 82 return value
166 """ eric-bugs@eric-ide.python-projects.org.\n""" 167 """ eric-bugs@eric-ide.python-projects.org.\n"""
167 ) 168 )
168 raise 169 raise
169 170
170 # 171 #
171 # eflag: noqa = M801 172 # eflag: noqa = M801, I102

eric ide

mercurial