Python os.stat and unicode file names

前端 未结 5 824
我寻月下人不归
我寻月下人不归 2020-12-31 05:05

In my Django application, a user has uploaded a file with a unicode character in the name.

When I\'m downloading files, I\'m calling :

os.path.exists         


        
5条回答
  •  独厮守ぢ
    2020-12-31 05:18

    It is easy to get this kind of error when running service (E.g: gunicorn) from Upstart.

    To fix that, set env in upstart file:

    env LANG=en_US.UTF-8
    env LC_CTYPE=en_US.UTF-8
    env LC_ALL=en_US.UTF-8
    

提交回复
热议问题