Encodign issue in Python 3.3.1 (once again)

nagia.retsina at gmail.com nagia.retsina at gmail.com
Thu May 30 06:56:03 EDT 2013


Τη Πέμπτη, 30 Μαΐου 2013 1:53:33 μ.μ. UTC+3, ο χρήστης nagia.... at gmail.com έγραψε:
> Τη Πέμπτη, 30 Μαΐου 2013 12:29:56 μ.μ. UTC+3, ο χρήστης Michael Torrie έγραψε:
> 
> > On 05/29/2013 04:30 AM, nagia.retsina at gmail.com wrote:
> 
> > 
> 
> > > What makes us o sure it is a pymysql issue and not python's encoding
> 
> > 
> 
> > > issue?
> 
> > 
> 
> > 
> 
> > 
> 
> > The original traceback, which showed that the encoding error was
> 
> > 
> 
> > happening in
> 
> > 
> 
> > "/opt/python3/lib/python3.3/site-packages/pymysql/cursors.py", line 108.
> 
> > 
> 
> >  As was said, you solve that by passing a charset="utf-8" to the
> 
> > 
> 
> > connection string.
> 
> > 
> 
> > 
> 
> > 
> 
> > So doing that solved the encoding problem (a query is now being
> 
> > 
> 
> > successfully built and sent to mysql) and went on to expose another
> 
> > 
> 
> > problem (bug) in your code, but I cannot tell what that is, since the
> 
> > 
> 
> > error happened in a subprocess and the traceback got sent to /dev/null.
> 
> > 
> 
> >  I suspect is has something to do with how the query results are being
> 
> > 
> 
> > returned, or it could have something to do with the query itself.
> 
> > 
> 
> > Python DB API does not specify exactly which style of prepared
> 
> > 
> 
> > statements should be used by a given third-party module.  So differences
> 
> > 
> 
> > in syntax between how pymysql and MysqlDB define the variables could be
> 
> > 
> 
> > the problem.
> 
> > 
> 
> > 
> 
> > 
> 
> > In any case your course is clear.  Run pelatologio.py outside of your
> 
> > 
> 
> > templating system and see what the traceback says exactly now that the
> 
> > 
> 
> > charset issue is fixed.
> 
> 
> 
> Good morning Michael,
> 
> 
> 
> I'am afraid as much as you dont want to admin it that the moment i append the charset directive into the connections tring i receive a huge error which it can be displayed in:
> 
> 
> 
> http://superhost.gr/cgi-bin/pelatologio.py
> 
> 
> 
> This is run directly isolated form the templating system.

AttributeError: 'NoneType' object has no attribute 'id' 
      args = ("'NoneType' object has no attribute 'id'",) 
      with_traceback = <built-in method with_traceback of AttributeError object>

is the error while i have no id varibale just an 'ID' inside:

cur.execute('''SELECT ID FROM clients WHERE name = %s''', (name,) )



More information about the Python-list mailing list