debugging - Debug python that wont respect a catch statement -


i trying run avg part of program. program executed automatically, cant see standard output python.

when run program calling directly, works perfectly, when run via automation, fails.

it in syslog -> "starting scan of: xxx", never says "unexpected error" or "scan results". means, failing, not using catch statement, or reporting error in "out" variable.

the offending function:

# scan file viruses # fpath -> fullpath, tname -> filename, tpath -> path file def scan(fpath, tname, tpath):     syslog("starting scan of: " + tname)     command = ["avgscan",           "--report=" + tpath + "scan_result-" + tname +".txt",           fpath]     try:         out = subprocess.call(command)         syslog("scan results: " + str(out))     except:         syslog("unexpected error: " + sys.exc_info()[0])     finally:         syslog("finished scan()") 

both idea's far around debugging code itself, prior this, scan simple subprocess.call(command) simple syslog output. statement, try catch added debugging.

i suspecting error opening of debug file; with statements not prevent exceptions being raised. in fact, usually raise exceptions of own.

note change of scope of try/except block.

# scan file viruses # fpath -> fullpath, tname -> filename, tpath -> path file def scan(fpath, tname, tpath):     syslog("starting scan of: " + tname)     command = ["avgscan",         "--report=" + tpath + "scan_result-" + tname +".txt",         fpath]     try:         open(tpath + tname + "-debug.txt", "w") output:             out = subprocess.call(command, stdout = output, stderr = output)             syslog("scan results: " + str(out))     except:         syslog("unexpected error: " + sys.exc_info()[0])     finally:         syslog("finished scan()") 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

python - Django-cities exits with "killed" -

python - How to get a widget position inside it's layout in Kivy? -