flaskのもっとも簡単なプログラムを実行しようとしたのですが、エラーが出ます。
プログラムは
python
1from flask import Flask 2app = Flask(__name__) 3 4@app.route('/') 5 6def hello_world(): 7 return 'Hello, World!' 8 9if __name__ == "__main__": 10 app.run()
で実行したところ、
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x83 in position 0: invalid start byte
という表示が出ました。
原因と解決方法を教えてください。
python3.8.3dで、osはwindows10,hello_flask.pyというファイルを作成しvscodeで実行しました。
実行結果です。
error
1 2PS C:\Users\programming\python> & C:/Users/AppData/Local/Programs/Python/Python38/python.exe c:/Users/programming/python/hello_flask.py 3* Serving Flask app "hello_flask" (lazy loading) 4* Environment: production 5WARNING: This is a development server. Do not use it in a production deployment. 6Use a production WSGI server instead. 7* Debug mode: off 8Traceback (most recent call last): 9File "c:/Users/programming/python/hello_flask.py", line 10, in <module> 10app.run() 11File "C:\Users\AppData\Local\Programs\Python\Python38\lib\site-packages\flask\app.py", line 990, in run 12run_simple(host, port, self, **options) 13File "C:\Users\AppData\Local\Programs\Python\Python38\lib\site-packages\werkzeug\serving.py", line 1052, in run_simple 14inner() 15File "C:\Users\AppData\Local\Programs\Python\Python38\lib\site-packages\werkzeug\serving.py", line 996, in inner 16srv = make_server( 17File "C:\Users\AppData\Local\Programs\Python\Python38\lib\site-packages\werkzeug\serving.py", line 847, in make_server 18return ThreadedWSGIServer( 19File "C:\Users\AppData\Local\Programs\Python\Python38\lib\site-packages\werkzeug\serving.py", line 740, in __init__ 20HTTPServer.__init__(self, server_address, handler) 21File "C:\Users\AppData\Local\Programs\Python\Python38\lib\socketserver.py", line 452, in __init__ 22self.server_bind() 23File "C:\Users\AppData\Local\Programs\Python\Python38\lib\http\server.py", line 140, in server_bind 24self.server_name = socket.getfqdn(host) 25File "C:\Users\AppData\Local\Programs\Python\Python38\lib\socket.py", line 756, in getfqdn 26hostname, aliases, ipaddrs = gethostbyaddr(name) 27UnicodeDecodeError: 'utf-8' codec can't decode byte 0x83 in position 0: invalid start byte
回答5件
あなたの回答
tips
プレビュー