Στις 27/8/2013 4:59 μμ, ο/η ishish έγραψε:
[Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] Error in
sys.excepthook:
[Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189]
ValueError: underlying buffer has been detached
[Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189]
[Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] Original
exception was:
[Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] Traceback
(most recent call last):
[Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189]   File
"/home/nikos/public_html/cgi-bin/metrites.py", line 169, in <module>
[Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189]
cur.execute('''SELECT ID FROM counters WHERE url = %s''', page )
[Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189]   File

"/usr/local/bin/python/lib/python3.3/site-packages/pymysql/cursors.py",
line 108, in execute
[Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189]     query
= query % escaped_args
[Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189]
TypeError: unsupported operand type(s) for %: 'bytes' and 'str'

I quote from a Python 3 Guide
[http://python.about.com/od/python30/ss/30_strings_3.htm]:

The two data types, str and bytes, are mutually exclusive. One cannot
legally combine them into one call. With the distinction between text
and data, therefore, comes the need to convert between them.



So, in this line:

cur.execute('''SELECT ID FROM counters WHERE url = %s''', page )

the variable 'page' needs conversion to what?

all that is stores is the location of a file

path = '/home/nikos/public_html/'

page = form.getvalue('page')

if not page and os.path.exists( file ):
        # it is an html template
        page = file.replace( path, '' )

So chnage it to what?
--
What is now proved was at first only imagined!
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to