1

我是 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)   

我不知道如何解决它。有人可以帮助我吗?谢谢。

4

2 回答 2

1

我的猜测是由于路径中的特殊字符存在问题,桌面. 尝试将文件夹移动到

/home/jsying/flaskr/

于 2013-05-04T02:57:00.097 回答
0

在没有“桌面”的情况下修改您的路径。

于 2013-05-04T02:57:23.827 回答