I am working on a Tkinter GUI that will display software package's install status. I work for a company that wants to control how software is installed and where. Anyway, the package installer I am working with currently prints to a console window for each software package installed. So, if we have 4 packages, it would open 4 windows in sequence. I want it to just print what it is doing in a Tkinter GUI instead of opening windows, but I cannot figure out how to redirect the print streams in the custom package installer.
Here is the main module I am trying to redirect data from:
def InstallPack(PackageName):
""" Installs a software package """
iniFile = '\\\\%s\\client$\\Packages\\%s\\package.ini' % (serverName, PackageName)
print iniFile
config = section2Dict(iniFile)
reg = ConnectRegistry(None, HKEY_LOCAL_MACHINE)
regpath = r"SOFTWARE\MCIS"
key = OpenKey(reg, regpath, 0, KEY_ALL_ACCESS)
iniSerial = config['SerialNumber']
try:
q = QueryValueEx(key, PackageName)
RegSerial = q[0]
#print "Package: %s found in Registry!" % PackageName
if RegSerial == iniSerial:
print "Package already installed. Installation aborted!"
sys.exit(0)
except WindowsError:
# Package not installed
pass
print 'Installing package: %s' % PackageName
print 'Description: %s' % config['Description']
zipPart(PackageName, config['ZipFile'])
regPart(PackageName, config['RegFile'], config['RegType'])
SetValueEx(key, PackageName, 0, REG_EXPAND_SZ, iniSerial)
CloseKey(key)
Thanks a lot!
Mike
-- http://mail.python.org/mailman/listinfo/python-list