[python-win32] Re: Damaged Pythonwin installation
Bob Gailer
bgailer at alum.rpi.edu
Mon Dec 20 20:01:57 CET 2004
This is symptomatic of a long-standing unsolved Pythonwin problem in which
Pythonwin keeps adding toobar entries to the registry until it chokes.
Several outstanding bug reports comment on this.
Unfortunately no one knows how to fix the problem.
Here's a Python program to clean up the registry:
import win32api
import win32con
subKey = r'Software\Python 2.3\Python for Win32'
#HKEY_CURRENT_USER\Software\Python 2.3\Python for Win32\ToolbarDebugging-Bar0
k =
win32api.RegOpenKeyEx(win32con.HKEY_CURRENT_USER,subKey,0,win32con.KEY_ALL_ACCESS)
nsubkeys,nvalues,timeval = win32api.RegQueryInfoKey(k)
keys = []
for i in range(nsubkeys):
s = win32api.RegEnumKey(k,i)
if (s.startswith('ToolbarDefault-Bar') or
s.startswith('ToolbarDebugging-Bar')):
keys.append(s)
for i,key in enumerate(keys):
subKey2 = subKey + '\\' + key
print i,':', subKey2
win32api.RegDeleteKey(win32con.HKEY_CURRENT_USER,subKey2)
if i>99999:
break
k.Close()
print len(keys),"deleted."
Do NOT run this from within Python win. Use a command prompt or another IDE.
Bob Gailer
bgailer at alum.rpi.edu
303 442 2625 home
720 938 2625 cell
More information about the Python-win32
mailing list