Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 How to ignore - ERROR: The system was unable to find the specified registry key or va
#1
def isAlreadyInstalled(lookupRegistryKey):
    consoleLines = os.popen('reg query "' + APP_REGISTRY_KEY + "\\" + VERSION_SYSTEM_NAME + '"').readlines()
    if len(consoleLines) == 0:
        return False
    return True
I have this snippet. The problem is that it gives this error in the command line without stoping the execution ( wich is ok for my cas), I just want to ignore this error.

ERROR: The system was unable to find the specified registry key or value.
Quote
#2
Does it also error in python?
Quote
#3
No, my script is working ok. But this just pops there and i don't want to see it.

I'm looping for 5 minutes, call this method evrey second to check if a program is installed or not. I want to ignore this if possible somehow here inside the method
Quote
#4
use try/except block, with the except capturing the specific error
and content of except 'pass'
Quote
#5
  
 def isAlreadyInstalled(lookupRegistryKey):
        try:
            consoleLines = os.popen('reg query "' + APP_REGISTRY_KEY + "\\" + VERSION_SYSTEM_NAME + '"').readlines()
            if len(consoleLines) == 0:
                return False
            return True
        except OSError:
            pass
This is not working.
Quote
#6
you haven't shown the error message.
Post that verbatim please
Quote
#7
This is the error shown in the command line:

ERROR: The system was unable to find the specified registry key or value.
Quote
#8
This error does not look like a python generated error traceback as it is incomplete.
if that's all you have, then you need to show more code, especially the 'lookupRegistryKey'
method or function (or package name if in a package). Soesn't loog like a winreg error either.

Can't help with information provided.
Quote
#9
If it's not stopping the execution of the program, it's not an error from Python's perspective. A try/except block certainly won't work. I don't know if there is anything you can do in Python to stop it. Is there perhaps an option to the system command you are using that would suppress the error output?
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures

Quote
#10
APP_REGISTRY_KEY - HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths
lookupRegistryKey = theNameOfTheApplication

@ichabod801 - there is but in this case my condition( if len(consoleLines) == 0: ) will always be false since.
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  How to ignore formulas when reading excel file SriMekala 3 127 Aug-16-2019, 04:04 PM
Last Post: buran
  Get system info from PI (cpu load and temp) korenron 2 124 Aug-04-2019, 08:45 AM
Last Post: korenron
  Error :unable to detect undefined names created in spyder ide error at line 2 milind_eac 2 101 Jul-30-2019, 10:29 PM
Last Post: milind_eac
  FileNotFoundError...System cannot find the path specified alex9745 28 3,545 Jul-23-2019, 05:14 AM
Last Post: alex9745
  Unable to install pyaudio junzhi 1 268 Jul-21-2019, 05:00 PM
Last Post: snippsat
  Unable to allocate specific memory VirtualDreamer 1 98 Jul-13-2019, 07:04 AM
Last Post: Gribouillis
  Unable to parse xml file avi1990pr 1 275 Jun-21-2019, 04:56 AM
Last Post: mcmxl22
  Difference between os.system("clear") and os.system("cls") chmsrohit 6 466 Jun-16-2019, 11:38 AM
Last Post: DeaD_EyE
  Unable to get the data pythonFresher 5 224 May-22-2019, 03:16 PM
Last Post: buran
  Fatal error in launcher: Unable to create process using '"' rsmldmv 0 352 May-13-2019, 01:34 AM
Last Post: rsmldmv

Forum Jump:


Users browsing this thread: 1 Guest(s)