473,324 Members | 2,501 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

EnumKey vs EnumValue

I'm having trouble getting any responses back from the following
snippet, where I am just trying to read some data from the Windows
Registry. I intend to do a little bit more with this but will work on
that later, but I think I can get more data back from EnumValue, I'd
like to see the differences between them. I am running Python 2.3 on
XP and can get a response from EnumKey, but EnumValue returns nothing
at all; the key listing even returns 0 keys when it prints out the
status. But EnumKey returns the right number and even prints out the
keys I expect, I copied some of this from the Cookbook and can't tell
what might be the problem.

Thanks for any help.

- M
-------------------------------------

from _winreg import *

findkey = raw_input("What key do you want to look for? ")

key = "SOFTWARE\\"+findkey
machine = ConnectRegistry(None,HKEY_LOCAL_MACHINE)
regpath = OpenKey(machine,key)

print "Looking for",key

for i in range(25):
try:
regEndeca = EnumKey(regpath,i)
print regEndeca
except EnvironmentError:
print "There are", i,"keys under",key
break
print "That was using EnumKey."

for j in range(25):
try:
regstr,value,type = EnumValue(regpath,j)
print regstr,value,type
except EnvironmentError:
print "There are", j,"keys under",key
break
print "That was using EnumValue."

Jul 19 '05 #1
0 2262

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Andy Venikov | last post by:
Sometimes you want to use a bitfield to hold an enum value. In such cases you would only use as many bits as are needed to encode the full set of enum values. And it is a pain to recompute and...
3
by: Matt | last post by:
Hi, Recently we had some code like this cause a failure: MyEnum myEnum = (MyEnum) (int) dt; i.e. reading an int out of the database and casting it into a type-safe enum. The thought...
1
by: Rob F | last post by:
Hell I'm wondering if anyone can shed some light on this? I'm trying to enumerate the uninstall registry key (to display installed applications) with VB.NET and WMI I'm pretty stuck. When I...
7
by: Harris | last post by:
Dear all, I have the following codes: ====== public enum Enum_Value { Value0 = 0, Value1 = 10,
1
by: delwar66 | last post by:
Hi Is anyone here who can help me to get this scripts running under alternate credentials................. ''''''''''''''''''''''''''' ''''''''''''''''''''''''''' ' Monitor EDID...
0
by: jsmith72 | last post by:
Can some Please tell me why the following collection is not XML Serializable: Imports System.Xml Imports System.Runtime.Serialization Namespace MyNamespace <Serializable()Public Class...
1
by: walterbyrd | last post by:
Lets suppose, I want a listing of what hardware and software is installed on my windows box. Can I do that with Python?
2
by: hellt | last post by:
HI all, i found winreg module from http://www.rutherfurd.net/python/winreg/index.html very useful and simple, instead _winreg. But i have a problem with this module, in its iterable part. look...
11
by: Unknown Hero | last post by:
Tim Golden wrote: The first link which points to the Python documentation for the _winreg module I already checked, even before coming here. I am wondering how I should do the loop I need (go...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.