我是Python的初学者。 我想学习一个Web框架,我选择了Flask。 我已经完成了快速入门。 在那之后,我继续学习教程。 但是,我被困住了。
我在github上克隆了这个项目 https://github.com/zhangjingqiang/flaskr
我跑了python flaskr.py
并打开了我的网络浏览器,检查它是否有效。
我收到此错误消息:
Exception happened during processing of request from ('127.0.0.1', 60970)
Traceback (most recent call last):
File "/usr/lib/python2.7/SocketServer.py", line 295, in _handle_request_noblock
self.process_request(request, client_address)
File "/usr/lib/python2.7/SocketServer.py", line 321, in process_request
self.finish_request(request, client_address)
File "/usr/lib/python2.7/SocketServer.py", line 334, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/lib/python2.7/SocketServer.py", line 649, in __init__
self.handle()
File "/home/jsying/桌面/flaskr/venv/local/lib/python2.7/site-packages/werkzeug/serving.py", line 182, in handle
rv = BaseHTTPRequestHandler.handle(self)
File "/usr/lib/python2.7/BaseHTTPServer.py", line 340, in handle
self.handle_one_request()
File "/home/jsying/桌面/flaskr/venv/local/lib/python2.7/site-packages/werkzeug/serving.py", line 217, in handle_one_request
return self.run_wsgi()
File "/home/jsying/桌面/flaskr/venv/local/lib/python2.7/site-packages/werkzeug/serving.py", line 176, in run_wsgi
traceback.plaintext)
File "/home/jsying/桌面/flaskr/venv/local/lib/python2.7/site-packages/werkzeug/utils.py", line 77, in __get__
value = self.func(obj)
File "/home/jsying/桌面/flaskr/venv/local/lib/python2.7/site-packages/werkzeug/debug/tbtools.py", line 332, in plaintext
return u'\n'.join(self.generate_plaintext_traceback())
File "/home/jsying/桌面/flaskr/venv/local/lib/python2.7/site-packages/werkzeug/debug/tbtools.py", line 326, in generate_plaintext_traceback
frame.function_name
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 13: ordinal not in range(128)
我不知道如何修复它。有人能帮助我吗?感谢。
答案 0 :(得分:1)
我的猜测是因为路径中的特殊字符桌面
存在问题。尝试将文件夹移动到
/home/jsying/flaskr/
答案 1 :(得分:0)
修改没有“桌面”的路径。