Solved

WindowsError: [Error 2] The system cannot find the file specified

Posted on 2011-03-25
3
1,114 Views
Last Modified: 2012-05-11
I keep getting this error
 Traceback (most recent call last):
File "C:/Documents and Settings/dolamite/Desktop/reg.py", line 4, in <module>
    aKey = OpenKey(aReg, r'SOFTWARE\SEMS_Event_Managment')
WindowsError: [Error 2] The system cannot find the file specified


from _winreg import *

aReg = ConnectRegistry(None,HKEY_LOCAL_MACHINE)
aKey = OpenKey(aReg, r'SOFTWARE\SEMS_Event_Managment')
expiration = QueryValueEx(aKey, "Expiration")
print expiration
CloseKey(aKey)

Open in new window


I am trying to get the expiration date from the registry

the exact location of the registry Im trying to locate is
My Computer\HKEY_LOCAL_MACHINE\SOFTWARE\SEMS_Event_Managment

Expiration

what am I doing wrong ?

 
0
Comment
Question by:dolamitejenkins
  • 2
3 Comments
 
LVL 28

Accepted Solution

by:
pepr earned 500 total points
Comment Utility
You can simplify it the following way:

from _winreg import *

aKey = OpenKey(HKEY_LOCAL_MACHINE, r'SOFTWARE\SEMS_Event_Managment')
expiration = QueryValueEx(aKey, "Expiration")
print expiration
CloseKey(aKey)

Open in new window


However, such error message can be observed when there is no such key in registry.  Check it with regedit.exe.
0
 

Author Comment

by:dolamitejenkins
Comment Utility
thank I will try this...
0
 

Author Closing Comment

by:dolamitejenkins
Comment Utility
perfect thanks
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

"The time has come," the Walrus said, "To talk of many things: Of sets--and lists--and dictionaries-- Of variable kinks-- And why you see it changing not-- And why so strange are strings." This part describes how variables and references (see …
Variable is a place holder or reserved memory locations to store any value. Which means whenever we create a variable, indirectly we are reserving some space in the memory. The interpreter assigns or allocates some space in the memory based on the d…
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now