[Zope] Registering Zope's Python Instance in Win32
Samir Mishra
SamirMishra at cbuae.gov.ae
Tue Feb 17 00:29:00 EST 2004
Never mind, found what I was looking for. On
http://effbot.org/zone/python-register.htm (thanks!).
Thought I'd include the script in case this issue comes up for anyone else.
#
# script to register Python 2.0 or later for use with win32all
# and other extensions that require Python registry settings
#
# written by Joakim Löw for Secret Labs AB / PythonWare
#
# source:
# http://www.pythonware.com/products/works/articles/regpy20.htm
import sys
from _winreg import *
# tweak as necessary
version = sys.version[:3]
installpath = sys.prefix
regpath = "SOFTWARE\\Python\\Pythoncore\\%s\\" % (version)
installkey = "InstallPath"
pythonkey = "PythonPath"
pythonpath = "%s;%sLib\\;%sDLLs\\" % (
installpath, installpath, installpath
)
def RegisterPy():
try:
reg = OpenKey(HKEY_LOCAL_MACHINE, regpath)
except EnvironmentError:
try:
reg = CreateKey(HKEY_LOCAL_MACHINE, regpath)
SetValue(reg, installkey, REG_SZ, installpath)
SetValue(reg, pythonkey, REG_SZ, pythonpath)
CloseKey(reg)
except:
print "*** Unable to register!"
return
print "--- Python", version, "is now registered!"
return
if (QueryValue(reg, installkey) == installpath and
QueryValue(reg, pythonkey) == pythonpath):
CloseKey(reg)
print "=== Python", version, "is already registered!"
return
CloseKey(reg)
print "*** Unable to register!"
print "*** You probably have another Python installation!"
return
if __name__ == "__main__":
RegisterPy()
-----Original Message-----
From: Samir Mishra [mailto:SamirMishra at cbuae.gov.ae]
Sent: Tuesday, February 17, 2004 09:19
To: 'zope at zope.org'
Subject: [Zope] Registering Zope's Python Instance in Win32
Hi all,
I'd like to register the Python that comes with Zope as the primary python
instance. Last time I did this, i.e., used a python script to update the
windows registry, it was someone on this mailing list who was kind enough to
point me to the right place/method. I've lost the link, tried finding it on
Zope.org without success, and am now hoping someone on can help me out
again...
Thanks.
Samir
_______________________________________________
Zope maillist - Zope at zope.org
http://mail.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )
More information about the Zope
mailing list