Τη Τετάρτη, 28 Αυγούστου 2013 3:21:25 μ.μ. UTC+3, ο χρήστης Steven D'Aprano 
έγραψε:
> On Wed, 28 Aug 2013 03:43:08 -0700, Ferrous Cranus wrote:
> 
> 
> 
> > but i cannot see the error_log because of constant scrolling of error
> 
> > output.
> 
> 
> 
> Then don't use "tail -F", use "less".
> 
> 
> 
> Or try "tail -s 60 -F" which will update only every 60 seconds.
> 
> 
> 
> 
> 
> 
> 
> -- 
> 
> Steven

Very nice idea, than k you steven. Less work withiut scrilling like hell liek 
tail -F did.

this is what i have now:


# 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:
#find the needed counter for the page URL
        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()           #URL is unique, so should only be one
except:
        print( formatExceptionInfo() )

i see no error on what it used ot be isnteait comain at the follwing line which 
is:

                if not data:
                        #first time for page; primary key is automatic, hit is 
defaulted
                        cur.execute('''INSERT INTO counters (url) VALUES 
(%s)''', page )
                        cID = cur.lastrowid        #get the primary key value 
of the new record 
                else:
                        #found the page, save primary key and use it to issue 
hit UPDATE 
                        cID = data[0]
                        cur.execute('''UPDATE counters SET hits = hits + 1 
WHERE ID = %s''', cID )


i jst dont follow..... What ishsi proposed supposed to give us the error in the 
query bit now it tells difefrent things.

shoudl i remove the function since it want any helopfull?


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to