Am 21.11.2010 03:54 schrieb Karen McNeil:
I've got it half working: the form field is working fine, and the
filename is successfully added to the database. The problem comes up
when I added the code to actually save the file to the folder where it
should be; I get the error: *"TypeError: coercing to Unicode: need
string or buffer, instance found."
The exact place where the error happens is even more important for
finding the cause of such problems, you get it from the traceback.
I guess it happens in this line:
newtext = codecs.EncodedFile(new_file.value, 'utf-8')
The EcodedFile method takes a file object as first parameter, but
new_file.value gets your file data as a string. If you want to access
the data as a file object, use new_file.file instead.
-- Christoph
--
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.