Am 28.08.2013 12:14, schrieb Ferrous Cranus:
Okey, continue trying and trying i came up with this:
try:
if os.path.exists( path + page ) or os.path.exists( cgi_path + page
):
cur.execute('''SELECT ID FROM counters WHERE url = %s''', page )
data = cur.fetchone()
except:
with open("err.out", "a") as f:
f.write( repr(query), type(query) )
f.write( repr(escaped_args), type(escaped_args) )
But i cannot test it without looking at the error log which is
scrolling like hell and doesn't even quit with a ctrl+c
How will i manage to troubleshoot?
Please confirm the above is correct and is what you were propsoing i
shoudl test.
A simple way I always use if it comes to exception handling:
import sys
import traceback
# Exception Identification
def formatExceptionInfo(maxTBlevel=5):
cla, exc, trbk = sys.exc_info()
excName = cla.__name__
try:
excArgs = exc.__dict__["args"]
except KeyError:
excArgs = "<no args>"
excTb = traceback.format_tb(trbk, maxTBlevel)
return (excName, excArgs, excTb)
try:
# Your code
except:
print formatExceptionInfo()
--
http://mail.python.org/mailman/listinfo/python-list