This si what iam tryign now since the function ishish proposed wont help me.


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( repr(e) )


[Wed Aug 28 13:08:27 2013] [error] [client 108.162.231.120] Original exception 
was:
[Wed Aug 28 13:08:27 2013] [error] [client 108.162.231.120] Traceback (most 
recent call last):
[Wed Aug 28 13:08:27 2013] [error] [client 108.162.231.120]   File 
"/home/nikos/public_html/cgi-bin/metrites.py", line 174, in <module>
[Wed Aug 28 13:08:27 2013] [error] [client 108.162.231.120]     
cur.execute('''SELECT ID FROM counters WHERE url = %s''', page )
[Wed Aug 28 13:08:27 2013] [error] [client 108.162.231.120]   File 
"/usr/local/bin/python/lib/python3.3/site-packages/pymysql/cursors.py", line 
108, in execute
[Wed Aug 28 13:08:27 2013] [error] [client 108.162.231.120]     query = query % 
escaped_args
[Wed Aug 28 13:08:27 2013] [error] [client 108.162.231.120] TypeError: 
unsupported operand type(s) for %: 'bytes' and 'str'
[Wed Aug 28 13:08:27 2013] [error] [client 108.162.231.120] 
[Wed Aug 28 13:08:27 2013] [error] [client 108.162.231.120] During handling of 
the above exception, another exception occurred:
[Wed Aug 28 13:08:27 2013] [error] [client 108.162.231.120] 
[Wed Aug 28 13:08:27 2013] [error] [client 108.162.231.120] Traceback (most 
recent call last):
[Wed Aug 28 13:08:27 2013] [error] [client 108.162.231.120]   File 
"/home/nikos/public_html/cgi-bin/metrites.py", line 177, in <module>
[Wed Aug 28 13:08:27 2013] [error] [client 108.162.231.120]     print( repr(e) )
[Wed Aug 28 13:08:27 2013] [error] [client 108.162.231.120] NameError: name 'e' 
is not defined
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to