Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

windows registry

0 views
Skip to first unread message

A[r]TA

unread,
Apr 13, 2000, 3:00:00 AM4/13/00
to
Heyz..

How do I edit the windows registry with Python?

Thnx, A[r]TA


--
We shall not cease from exploration, and the end of all our exploring will
be to arrive where we started and know the place for the first time.
- T. S. Eliot


Roger Upole

unread,
Apr 13, 2000, 3:00:00 AM4/13/00
to
Use the win32 extensions, win32api.Reg...
Roger Upole

"A[r]TA" <ar...@x-stream.nl> wrote in message news:era0iGYp$GA.273@net003s...

Janos BEKESI

unread,
Apr 13, 2000, 3:00:00 AM4/13/00
to
The pythonwin package contains some interesting sources:

win32/scripts/regsetup.py

which uses (I think) win32/lib/regutil.py (the main module for handling
the registry). With a little effort one can figure out how things work.
Additionally there is some documentation included in the
win32/Help/Python Win32 Extensions.hlp-File, but looking at the sources
should show how all is put together. I used regutil.py for checking
whether there is python installed on a win32 system and if not, setting
the appropriate registry keys.

Hope it helps,

Janos.


> How do I edit the windows registry with Python?


Sent via Deja.com http://www.deja.com/
Before you buy.

Mark Hammond

unread,
Apr 14, 2000, 3:00:00 AM4/14/00
to
Note that in Python 1.6, there is a "winreg" standard module - ie, no need
for the win32 extensions.

This is taken from the win32api sources. The relevant differences are:

* The module name has obviously changed! The winreg module will raise
winreg.error (which happens to be thenew standard WindowsError exception
object, derived from OSError, derived from EnvironmentError, derived from
StandardError - so any of these error objects will catch the exceptions!)

* The function names have changed (eg, win32api.RegCreateKey ->
winreg.CreateKey)

* Security information is not supported - none must be passed to all
winreg functions that accept security information.

* winreg has docstrings, win32api has help files :-)

Apart from that, all args and usage are identical to the win32api
functions. Thus, in the general case, code can be changed to use winreg
from win32api with a couple of search-and-replaces!

Mark.

0 new messages