python flask 加载html运行错误
2016-11-23 14:22
337 查看
python flask 加载html运行错误
'utf8' codec can't decode byte 0xbb in
解决方法是 .py 文件不是utf8格式的文件导致
Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
[2016-11-23 11:51:51,020] ERROR in app: Exception on / [GET]
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/flask/app.py", line 1988, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.4/dist-packages/flask/app.py", line 1641, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.4/dist-packages/flask/app.py", line 1544, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.4/dist-packages/flask/_compat.py", line 33, in reraise
raise value
File "/usr/local/lib/python3.4/dist-packages/flask/app.py", line 1639, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.4/dist-packages/flask/app.py", line 1625, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "app.py", line 7, in home
return render_template('1.html')
File "/usr/local/lib/python3.4/dist-packages/flask/templating.py", line 133, in render_template
return _render(ctx.app.jinja_env.get_or_select_template(template_name_or_list),
File "/usr/local/lib/python3.4/dist-packages/jinja2/environment.py", line 851, in get_or_select_template
return self.get_template(template_name_or_list, parent, globals)
File "/usr/local/lib/python3.4/dist-packages/jinja2/environment.py", line 812, in get_template
return self._load_template(name, self.make_globals(globals))
File "/usr/local/lib/python3.4/dist-packages/jinja2/environment.py", line 774, in _load_template
cache_key = self.loader.get_source(self, name)[1]
File "/usr/local/lib/python3.4/dist-packages/flask/templating.py", line 57, in get_source
return self._get_source_fast(environment, template)
File "/usr/local/lib/python3.4/dist-packages/flask/templating.py", line 82, in _get_source_fast
return loader.get_source(environment, template)
File "/usr/local/lib/python3.4/dist-packages/jinja2/loaders.py", line 175, in get_source
contents = f.read().decode(self.encoding)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xbb in position 613: invalid start byte
127.0.0.1 - - [23/Nov/2016 11:51:51] "GET / HTTP/1.1" 500 -
'utf8' codec can't decode byte 0xbb in
解决方法是 .py 文件不是utf8格式的文件导致
Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
[2016-11-23 11:51:51,020] ERROR in app: Exception on / [GET]
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/flask/app.py", line 1988, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.4/dist-packages/flask/app.py", line 1641, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.4/dist-packages/flask/app.py", line 1544, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.4/dist-packages/flask/_compat.py", line 33, in reraise
raise value
File "/usr/local/lib/python3.4/dist-packages/flask/app.py", line 1639, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.4/dist-packages/flask/app.py", line 1625, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "app.py", line 7, in home
return render_template('1.html')
File "/usr/local/lib/python3.4/dist-packages/flask/templating.py", line 133, in render_template
return _render(ctx.app.jinja_env.get_or_select_template(template_name_or_list),
File "/usr/local/lib/python3.4/dist-packages/jinja2/environment.py", line 851, in get_or_select_template
return self.get_template(template_name_or_list, parent, globals)
File "/usr/local/lib/python3.4/dist-packages/jinja2/environment.py", line 812, in get_template
return self._load_template(name, self.make_globals(globals))
File "/usr/local/lib/python3.4/dist-packages/jinja2/environment.py", line 774, in _load_template
cache_key = self.loader.get_source(self, name)[1]
File "/usr/local/lib/python3.4/dist-packages/flask/templating.py", line 57, in get_source
return self._get_source_fast(environment, template)
File "/usr/local/lib/python3.4/dist-packages/flask/templating.py", line 82, in _get_source_fast
return loader.get_source(environment, template)
File "/usr/local/lib/python3.4/dist-packages/jinja2/loaders.py", line 175, in get_source
contents = f.read().decode(self.encoding)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xbb in position 613: invalid start byte
127.0.0.1 - - [23/Nov/2016 11:51:51] "GET / HTTP/1.1" 500 -
相关文章推荐
- 解决"学习python-flask教程,下载源码运行的时候出现:TypeError: 'bool' object is not callable 错误代码:"
- .net AJAX运行错误【 未能加载文件或程序集 "System.Web....】的解决办法
- javascript innerHTML出现未知运行时错误
- 17个新手常见Python运行时错误
- 【APP】python版本低引发python脚本运行错误
- Python运行的17个时新手常见错误小结
- C#在Windows 2000 和2003中运行出现的错误:"试图运行项目进出错:未能加载文件或程序集..."
- 17个新手常见Python运行时错误
- dll文件加载运行加载的14001错误,由于应用程序配置不正确,应用程序未能启动
- html img 加载错误时显示默认图片
- java运行错误:找不到或无法加载主类
- linux程序运行时加载共享库出现的错误
- 由vs 2005升级到vs 2008后,运行时出现错误:未能加载文件或程序集“System.Web.Extensions, Version=2.0.0.0, 怎么办?
- 解决htmlfile: 未知的运行时错误
- 17个新手常见Python运行时错误
- Image组件加载图片出现错误后如何让程序继续正常的运行?
- 运行apache时,产生错误 不能加载libphp5.so:undefined symbol: zend_parse_parameters
- 解决htmlfile: 未知的运行时错误
- Python运行的17个时新手常见错误小结
- 提问:ASP.NET 运行时错误 未能加载文件或程序集