Guys,
In the code below I am going into the registry to look for a certain item. In this case I am using (RtkAudioService). Once it finds it will give the location of it. ("C:\Program Files\Realtek\Audio\HDA\RtkAudioService64.exe") Now when someone enters something else in the input that is not located in this location I want it to come up and state something that this is not located here or something along that line. All I am getting is the following Error bellow. How would you guys approach this?
What Program would you like to search for? f
In the code below I am going into the registry to look for a certain item. In this case I am using (RtkAudioService). Once it finds it will give the location of it. ("C:\Program Files\Realtek\Audio\HDA\RtkAudioService64.exe") Now when someone enters something else in the input that is not located in this location I want it to come up and state something that this is not located here or something along that line. All I am getting is the following Error bellow. How would you guys approach this?
What Program would you like to search for? f
Error:Traceback (most recent call last):
File "C:\Python27\SearchPath.py", line 29, in <module>
print getMDACversion()
File "C:\Python27\SearchPath.py", line 15, in getMDACversion
hKey = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, RegLocation)
WindowsError: [Error 2] The system cannot find the file specified
1 2 3 4 5 6 7 8 9 10 11 12 13 |
import _winreg from _winreg import * usr_input = raw_input ( 'What Program would you like to search for? ' ) location = 'SYSTEM\\ControlSet001\\services\\' RegLocation = location + usr_input def getMDACversion(): hKey = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, RegLocation) result = _winreg.QueryValueEx(hKey, "ImagePath" ) return result[ 0 ] print getMDACversion() |