Changes between Initial Version and Version 1 of Ticket #17686, comment 1


Ignore:
Timestamp:
Feb 19, 2012, 11:10:49 AM (13 years ago)
Author:
Łukasz Rekucki

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #17686, comment 1

    initial v1  
    11This is a common error, which actually isn't Django related:
    22
    3 Most file system related functions in Python (like {{{os.stat}}}) accept unicode strings which are then encoded using the default encoding of the file system (see http://docs.python.org/library/sys.html#sys.getfilesystemencoding). This is actually the only sane thing to do - if you pass a manually encoding string you'll have no guarantee it will match what was actually written on the FS. On Unix platforms, this depends on the user's *locale*. Thus if the user you're running the server on, doesn't have a properly set {{{LC_ALL}}}, {{{LANG}}}, etc. in his enviroment, the FS encoding will be assumed ASCII  and os.stat will crash.
     3Most file system related functions in Python (like {{{os.stat}}}) accept unicode strings which are then encoded using the default encoding of the file system (see http://docs.python.org/library/sys.html#sys.getfilesystemencoding). This is actually the only sane thing to do - if you pass a manually encoded string you'll have no guarantee it will match what was actually written on the FS. On Unix platforms, this depends on the user's *locale*. Thus if the user you're running the server on, doesn't have a properly set {{{LC_ALL}}}, {{{LANG}}}, etc. in his enviroment, the FS encoding will be assumed ASCII  and os.stat will crash.
    44
    55I'm marking this as accepted, because I think it's worth putting a note about this in FileStorage docs.
Back to Top