R
R
RaymanPy2018-12-20 14:53:36
Python
RaymanPy, 2018-12-20 14:53:36

Flask UnicodeDecodeError 'UTF-8' on server startup?

from flask import Flask

app = Flask(__name__)
app.run()

* Serving Flask app "app" (lazy loading)
* Environment: production
WARNING: Do not use the development server in a production environment.
Use a production WSGI server instead.
* Debug mode: off
Traceback (most recent call last):
File "C:\Users\Rizvan\Desktop\Flask\app\app.py", line 6, in
app.run()
File "C:\Users\Rizvan \Desktop\Flask\venv\lib\site-packages\flask\app.py", line 943, in run
run_simple(host, port, self, **options)
File "C:\Users\Rizvan\Desktop\Flask\ venv\lib\site-packages\werkzeug\serving.py", line 814, in run_simple
inner()
File "C:\Users\Rizvan\Desktop\Flask\venv\lib\site-packages\werkzeug\serving.py" line 774,
fd=fd)
File "C:\Users\Rizvan\Desktop\Flask\venv\lib\site-packages\werkzeug\serving.py", line 660, in make_server
passthrough_errors, ssl_context, fd=fd)
File "C:\ Users\Rizvan\Desktop\Flask\venv\lib\site-packages\werkzeug\serving.py", line 577, in __init__
self.address_family), handler)
File "d:\anaconda\Lib\socketserver.py", line 453, in __init__
self.server_bind()
File "d:\anaconda\Lib\http\server.py", line 138, in server_bind
self.server_name = socket.getfqdn(host)
File "d:\anaconda\Lib\socket .py", line 673, in getfqdn
hostname, aliases, ipaddrs = gethostbyaddr(name)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xcf in position 7: invalid continuation byte
This error pops up when starting the Flask server.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2018-12-20
@RaymanPy

The problem is that your computer name contains Cyrillic characters.

Hostnames are composed of a series of labels concatenated with dots, as are all domain names. For example, "en.wikipedia.org" is a hostname. Each label must be between 1 and 63 characters long, and the entire hostname (including the delimiting dots but not a trailing dot) has a maximum of 253 ASCII characters.
The Internet standards for protocols mandate that component hostname labels may contain only the ASCII letters 'a' through 'z' (in a case-insensitive manner), the digits '0' through '9', and the hyphen ('-') . The original specification of hostnames in RFC 952, mandated that labels could not start with a digit or with a hyphen, and must not end with a hyphen. However, a subsequent specification (RFC 1123) permitted hostname labels to start with digits.No other symbols, punctuation characters, or white space are permitted .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question