Sorry coming back for more help. Hope you don’t mind, but my python knowledge just isn’t up to trying to troubleshoot these issues. This monitor script below, seemed to be working for us before, but for some reason now it generates errors.
The errors we see are the following, please be aware that the script it running on windows 10 and 11 machines. The first error seems to be occurring on windows 11 machines and the second on windows 10 from time to time. I cut and pasted the script directly from the site into a new custom monitor. Strange thing in that it did seem to run a few months ago, but now doesn’t at all.
Would be grateful for any help on this, as it’s a script we’d really like to have working 100%.
File “”, line 28, in collectprograms* UnboundLocalError: local variable ‘oK’ referenced before assignment
and
Custom Script Monitor : Standard Output: - Error Output: File “”, line 116
print “Installed softwares are :”
^
IndentationError: unindent does not match any outer indentation level
Sorry for asking, but is there anyway this script could be altered so it just alerts on new software installed and not alert on updated or uninstalled software?
The “UnboundLocalError: local variable referenced before assignment” error occurs in Python when you try to access a local variable before it has been assigned a value. This is typically caused by a typo, or by using the same name for a local variable and a global variable in the same scope or when you forget to assign a value to a local variable before using it.
x = x + 1
print(x) // This code will result in the error
to solve this…
x = 0 //assign a value to the local variable
x = x + 1
print(x)
To resolve the “UnboundLocalError: local variable referenced before assignment” error, you need to assign a value to the local variable before you use it. Another way to resolve this error is to use the global keyword to access the global variable with the same name.