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
Question Difference between Python's os.system and Perl's system command Agile741 13 393 Dec-02-2019, 04:41 PM
Last Post: Agile741
  Ignore Folder Evil_Patrick 3 142 Oct-29-2019, 07:44 AM
Last Post: Gribouillis
  Automatic registering python to registry kozaizsvemira 1 109 Oct-22-2019, 11:23 AM
Last Post: kozaizsvemira
  [split] FileNotFoundError...System cannot find the path specified powerrocker 1 144 Oct-03-2019, 09:09 AM
Last Post: buran
  How to ignore formulas when reading excel file SriMekala 3 598 Aug-16-2019, 04:04 PM
Last Post: buran
  Error :unable to detect undefined names created in spyder ide error at line 2 milind_eac 2 442 Jul-30-2019, 10:29 PM
Last Post: milind_eac
  FileNotFoundError...System cannot find the path specified alex9745 28 5,921 Jul-23-2019, 05:14 AM
Last Post: alex9745
  Fatal error in launcher: Unable to create process using '"' rsmldmv 0 1,589 May-13-2019, 01:34 AM
Last Post: rsmldmv
  Fatal Python error: Py_Initialize: unable to load the file system codec ecg1g15 0 793 Feb-12-2019, 12:16 PM
Last Post: ecg1g15
  [python]FileNotFoundError...System cannot find the path specified creichle 1 1,009 Jan-30-2019, 12:49 AM
Last Post: Larz60+

Forum Jump:


Users browsing this thread: 1 Guest(s)