0

I coded in app.py

from flask import Flask
app = Flask(__name__)

@app.route("/")
def index():
    return "Hello, World!"

if __name__ == "__main__":
    app.run(debug=True)

and result =

$ python app.py
 * Serving Flask app "app" (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: on
 * Restarting with stat
 * Debugger is active!
 * Debugger PIN: 167-696-126
Exception in thread Thread-1:
Traceback (most recent call last):
  File "C:\Python38\lib\threading.py", line 932, in _bootstrap_inner
    self.run()
  File "C:\Python38\lib\threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Python38\lib\site-packages\werkzeug\serving.py", line 996, in inner
    srv = make_server(
  File "C:\Python38\lib\site-packages\werkzeug\serving.py", line 847, in make_server
    return ThreadedWSGIServer(
  File "C:\Python38\lib\site-packages\werkzeug\serving.py", line 740, in __init__
    HTTPServer.__init__(self, server_address, handler)
  File "C:\Python38\lib\socketserver.py", line 452, in __init__
    self.server_bind()
  File "C:\Python38\lib\http\server.py", line 140, in server_bind
    self.server_name = socket.getfqdn(host)
  File "C:\Python38\lib\socket.py", line 756, in getfqdn
    hostname, aliases, ipaddrs = gethostbyaddr(name)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc3 in position 0: invalid continuation byte

I'm starting coding with python Flask but I can't fix this error please help me

I am wondering why "UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc3 in position 0: invalid continuation byte" this error aroused

and can you tell me how to open Flask server??

...and can you tell me what is the difference between python and python3?

rkdrjs
  • 1
  • Welcome. Python is usually an alias to some version of the interpreter. You can check this by typing python --version. There are many differences between versions 2.7 and 3.8, look at python.org starting from: https://wiki.python.org/moin/Python2orPython3. As for the error, you probably have some sort of file encoding error. Consider using Linux for development. – Slawomir Dziuba Jun 07 '20 at 14:36
  • Just "Python" is not specific about the version. Python3.8 is the most recent version, Python2.x is not supported anymore. It seems there is some string not encoded in valid utf-8, but Python expects it to be. This seems to be the same as issue as https://stackoverflow.com/questions/25948687/gethostbyaddr-raises-unicodedecodeerror-in-python-3 Check if your computers hostname includes non-ASCII characters. Renaming it might help. – Feodoran Jun 07 '20 at 14:36
  • Thank you my friends Thanks very much!!!!!!!!!!1 감사합니다 – rkdrjs Jun 07 '20 at 17:03

0 Answers0