Werkzeug引发BrokenFilesystemWarning [英] Werkzeug raises BrokenFilesystemWarning

查看:3108
本文介绍了Werkzeug引发BrokenFilesystemWarning的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我将表单数据发送到我的Flask应用程序时,我收到以下错误。它表示将使用UTF-8编码,但是语言环境已经是UTF-8。这个错误是什么意思?

  /home/.virtualenvs/project/local/lib/python2 .7 / site-packages / werkzeug / filesystem.py:63:
BrokenFilesystemWarning:检测到错误配置的UNIX文件系统:
将使用UTF-8作为文件系统编码而不是ANSI_X3.4-1968



  $ locale 
LANG = en_US.utf8
LANGUAGE = en_US.utf8
LC_CTYPE =en_US.utf8
LC_NUMERIC =en_US.utf8
LC_TIME =en_US.utf8
LC_COLLATE =en_US.utf8
LC_MONETARY =en_US.utf8
LC_MESSAGES =en_US.utf8
LC_PAPER =en_US.utf8
LC_NAME =en_US.utf8
LC_ADDRESS =en_US.utf8
LC_TELEPHONE =en_US.utf8
LC_MEASUREMENT =en_US.utf8
LC_IDENTIFICATION =en_US.utf8
LC_ALL = en_US.utf8


解决方案

这不是一个关键的错误,只是一个警告,Werkzeug无法检测到一个良好的区域设置d所以使用 UTF-8 。这个猜测可能是正确的。



请参阅此Arch Linux wiki文章如何正确设置区域设置。它提到Python可能会看到 ANSI_X3.4-1968 编码,即使正确配置了语言环境,如果您从某些环境(如Vim)运行。


执行时:!python -cimport sys; print(sys.stdout.encoding)在ViM中,输出可能是 ANSI_X3.4-1968 ,即使各地都设置正确。将 PYTHONIOENCODING 环境变量设置为 utf-8 以补救这种情况。


< blockquote>

I get the following error when I send form data to my Flask app. It says it will use the UTF-8 encoding, but the locale is already UTF-8. What does this error mean?

/home/.virtualenvs/project/local/lib/python2.7/site-packages/werkzeug/filesystem.py:63:
BrokenFilesystemWarning: Detected a misconfigured UNIX filesystem:
Will use UTF-8 as filesystem encoding instead of 'ANSI_X3.4-1968'

$ locale
LANG=en_US.utf8
LANGUAGE=en_US.utf8
LC_CTYPE="en_US.utf8"
LC_NUMERIC="en_US.utf8"
LC_TIME="en_US.utf8"
LC_COLLATE="en_US.utf8"
LC_MONETARY="en_US.utf8"
LC_MESSAGES="en_US.utf8"
LC_PAPER="en_US.utf8"
LC_NAME="en_US.utf8"
LC_ADDRESS="en_US.utf8"
LC_TELEPHONE="en_US.utf8"
LC_MEASUREMENT="en_US.utf8"
LC_IDENTIFICATION="en_US.utf8"
LC_ALL=en_US.utf8

解决方案

This is not a critical error, just a warning that Werkzeug couldn't detect a good locale and so is using UTF-8 instead. This guess is probably correct.

See this Arch Linux wiki article for how to set up the locale correctly. It mentions that Python may see the ANSI_X3.4-1968 encoding even if the locale is properly configured, if you are running from certain environments such as Vim.

When executing :!python -c "import sys; print(sys.stdout.encoding)" in ViM, the output may be ANSI_X3.4-1968, even if the locale is set correctly everyhere. Set the PYTHONIOENCODING environment variable to utf-8 to remedy the situation.

这篇关于Werkzeug引发BrokenFilesystemWarning的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆