Frank, I have a few tips for you...

1. The last thing on a trace is usually the most important, the error
says "UnicodeDecodeError: 'ascii' code can't decode byte 0xff in
position 47: ordinal not in range(128).  So it seems the software is
trying to convert a byte into a character and it's not an ascii
character.  This could mean that your filename had a non-ascii
character in it, or that your <FORM> tag didn't have the
enctype="multipart/form-data" attribute.  I would also check to make
sure your <FORM> is using method="POST".

2. I noticed you were using mysql for the backend.  I believe that
sqlobject 0.7.1 uses a mysql driver designed for the 4.x mysql series,
and in any case I (and others) have never gotten it to accept unicode
correctly.  The "create table" sql statements generated by sqlobject
don't seem to contain the proper "CHARACTER SET utf8" that mysql 4.1
requires to support unicode.  Perhaps some people have gotten it to
work?  Personally I just switched to Postgresql.  To test the theory,
you could of course try the sqlite driver to see if you get the same
error.

3. Sometimes unicode errors are because of the client *not* sending
with the expected character-type, and all you need to do is put this
meta-tag in your <head>: <meta http-equiv="Content-type"
value="text/html; charset=utf-8">

4. Also check your config to make sure your templates default to using
utf-8, and search this google group for other unicode tips.

hope this helps, let us know what ends up working for you!
-ian

On Nov 18, 10:51 pm, "chiangf" <[EMAIL PROTECTED]> wrote:
> I was trying the file upload 
> tutorial:http://trac.turbogears.org/turbogears/wiki/StoringAndRetrievingFilesF...
>
> At first I was trying variations, but at the end, I basically just
> copied it and it still didn't work.  So the code is the same as the
> tutorial.
>
> Below is the trace:
>   File
> "C:\Python24\lib\site-packages\sqlobject-0.7.1-py2.4.egg\sqlobject\declarative.py",
> line 93, in _wrapper
>     return fn(self, *args, **kwargs)
>   File
> "C:\Python24\lib\site-packages\sqlobject-0.7.1-py2.4.egg\sqlobject\main.py",
> line 1198, in __init__
>     self._create(id, **kw)
>   File
> "C:\Python24\lib\site-packages\sqlobject-0.7.1-py2.4.egg\sqlobject\main.py",
> line 1225, in _create
>     self._SO_finishCreate(id)
>   File
> "C:\Python24\lib\site-packages\sqlobject-0.7.1-py2.4.egg\sqlobject\main.py",
> line 1249, in _SO_finishCreate
>     id, names, values)
>   File
> "C:\Python24\lib\site-packages\sqlobject-0.7.1-py2.4.egg\sqlobject\dbconnection.py",
> line 765, in queryInsertID
>     return self._dbConnection._queryInsertID(
>   File
> "C:\Python24\lib\site-packages\sqlobject-0.7.1-py2.4.egg\sqlobject\mysql\mysqlconnection.py",
> line 94, in _queryInsertID
>     self._executeRetry(conn, c, q)
>   File
> "C:\Python24\lib\site-packages\sqlobject-0.7.1-py2.4.egg\sqlobject\mysql\mysqlconnection.py",
> line 73, in _executeRetry
>     myquery = unicode(query, self.encoding)
> UnicodeDecodeError: 'ascii' codec can't decode byte 0xff in position
> 47: ordinal not in range(128)
> 
> Does anyone know why this error occurs?
> 
> Thanks!
> 
> Frank


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to