Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python ';ASCII';在Jupyter笔记本中编码导致BrokenFileSystemWarning_Python_Python 3.x_Jupyter Notebook_Jupyter_Werkzeug - Fatal编程技术网

Python ';ASCII';在Jupyter笔记本中编码导致BrokenFileSystemWarning

Python ';ASCII';在Jupyter笔记本中编码导致BrokenFileSystemWarning,python,python-3.x,jupyter-notebook,jupyter,werkzeug,Python,Python 3.x,Jupyter Notebook,Jupyter,Werkzeug,我开始制作一个从linux服务器运行的python3 werkzeug web应用程序,但每次我尝试从Jupyter笔记本启动它时,它都会显示此警告(导致浏览器中出现500内部服务器错误) 我尝试禁用警告,但web视图无论如何都会中断(唯一的区别是警告不会显示在Jupyter中)。我找到了编码 使用sys.getfilesystemencoding(),每次从Jupyter运行时返回“ascii”,但在Jupyter之外的同一台机器上运行时返回“utf-8” tl;dl 有没有办法改变Jupyt

我开始制作一个从linux服务器运行的python3 werkzeug web应用程序,但每次我尝试从Jupyter笔记本启动它时,它都会显示此警告(导致浏览器中出现500内部服务器错误

我尝试禁用警告,但web视图无论如何都会中断(唯一的区别是警告不会显示在Jupyter中)。我找到了编码 使用sys.getfilesystemencoding(),每次从Jupyter运行时返回“ascii”,但在Jupyter之外的同一台机器上运行时返回“utf-8”

tl;dl
有没有办法改变Jupyter笔记本中的默认编码?

在搜索了几个小时后,我发现一个应该返回格式化html的函数返回了一个None类型,该类型在utf-8中不可编码,这导致了编码错误。主要问题是Werkzeug没有指定错误发生在哪一行

我看到了
BrokenFilesystemWarning:也检测到配置错误的UNIX文件系统
错误。挖掘代码后,我发现这个错误是无害的,只是
/usr/local/lib/python2.7/dist packages/werkzeug/filesystem.py中的一个警告:

        warnings.warn(
            'Detected a misconfigured UNIX filesystem: Will use UTF-8 as '
            'filesystem encoding instead of {0!r}'.format(rv),
            BrokenFilesystemWarning)

因此,我不会担心BrokenFilesystemWarning:检测到一个配置错误的UNIX文件系统
警告。

顺便说一句,我在原始wiki和其他stackoverflow线程上尝试了一些建议,但没有任何帮助。我以前从未使用过Jupyter笔记本,我只有一个建议。尝试在Python文件的(第一)行中使用以下表达式声明源文件的编码:
-*-coding:encoding-*-
,其中encoding是所需的编码。我尝试了#--coding:utf-8--但它似乎对环境没有影响。
        warnings.warn(
            'Detected a misconfigured UNIX filesystem: Will use UTF-8 as '
            'filesystem encoding instead of {0!r}'.format(rv),
            BrokenFilesystemWarning)