Hi all, I just ran into the same problem. Locally it doesn't occur, but it does on the server.
I share Karen's analysis that the variable path of type unicode cannot be encoded into ascii. However, sys.getfilesystemencoding is also "UTF-8", so I don't see why os.stat would try to encode using ascii anyway. Klaas > File "/usr/languages/python/2.6/lib/python2.6/genericpath.py", line 18, in > exists > st = os.stat(path) > > UnicodeEncodeError: 'ascii' codec can't encode character u'\xe7' in position > 53: ordinal not in range(128) > > "path" here includes the file name, no file data is involved. Django is > passing a unicode string "path" to the os.stat() function. On many operating > systems, Python must actually pass a bytestring, not unicode, to the > underlying OS routine that implements "stat". Therefore Python must convert > the unicode string to a bytestring using some encoding. The encoding it uses > is whatever is returned by > os.getfilesystemencoding:http://docs.python.org/library/sys.html#sys.getfilesystemencoding. > As noted > in that documentation, on Unix the encoding will be: > > ... the user’s preference according to the result of nl_langinfo(CODESET), > or None if the nl_langinfo(CODESET) failed. > > That's a pretty obscure description but it boils down to the encoding > associated with the currently set locale. (And on some systems successfully > setting a locale with an encoding like utf-8 requires installing some > "extra" language packs.) So the key to fixing this problem is to ensure the > locale of the running server is successfully set to one with an encoding > such as utf-8, which supports (can encode) the full range of unicode values. > Unfortunately details on setting locales differs from machine to machine so > it is hard to give specific instructions here. > > Karen > --http://tracey.org/kmt/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.