Τη Τετάρτη, 28 Αυγούστου 2013 2:51:03 μ.μ. UTC+3, ο χρήστης ishish έγραψε: > 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()
ni...@superhost.gr [~/www]# [Wed Aug 28 12:02:53 2013] [error] [client 108.162.231.120] malformed header from script. Bad header=<class 'str'> 'index.html': metrites.py [Wed Aug 28 12:02:53 2013] [error] [client 108.162.231.120] Error in sys.excepthook: [Wed Aug 28 12:02:53 2013] [error] [client 108.162.231.120] ValueError: underlying buffer has been detached [Wed Aug 28 12:02:53 2013] [error] [client 108.162.231.120] [Wed Aug 28 12:02:53 2013] [error] [client 108.162.231.120] Original exception was: [Wed Aug 28 12:02:53 2013] [error] [client 108.162.231.120] Traceback (most recent call last): [Wed Aug 28 12:02:53 2013] [error] [client 108.162.231.120] File "/home/nikos/public_html/cgi-bin/metrites.py", line 191, in <module> [Wed Aug 28 12:02:53 2013] [error] [client 108.162.231.120] if not data: [Wed Aug 28 12:02:53 2013] [error] [client 108.162.231.120] NameError: name 'data' is not defined [Wed Aug 28 12:02:53 2013] [error] [client 108.162.231.120] File does not exist: /home/nikos/public_html/500.shtml -- http://mail.python.org/mailman/listinfo/python-list