0

I installed the latest version of Flask (flask-1.1.2) using pip.

I have a simple code and I named the file 'hello.py':

from flask import Flask


app = Flask(__name__)


@app.route('/')
def hello_world():
   return 'Hello, World!'

After that, I used two commands:

set FLASK_APP=hello.py
flask run

and saw this:

(env) C:\Users\Admin\Desktop\flask>flask run
  * Serving Flask app "hello.py"
  * Environment: production
    WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
  * Debug mode: off

Traceback (most recent call last):
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python38-32\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python38-32\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\Admin\Desktop\flask\env\Scripts\flask.exe\__main__.py", line 7, in <module>
  File "c:\users\admin\desktop\flask\env\lib\site-packages\flask\cli.py", line 967, in main
    cli.main(args=sys.argv[1:], prog_name="python -m flask" if as_module else None)
  File "c:\users\admin\desktop\flask\env\lib\site-packages\flask\cli.py", line 586, in main
    return super(FlaskGroup, self).main(*args, **kwargs)
  File "c:\users\admin\desktop\flask\env\lib\site-packages\click\core.py", line 782, in main
    rv = self.invoke(ctx)
  File "c:\users\admin\desktop\flask\env\lib\site-packages\click\core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "c:\users\admin\desktop\flask\env\lib\site-packages\click\core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "c:\users\admin\desktop\flask\env\lib\site-packages\click\core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "c:\users\admin\desktop\flask\env\lib\site-packages\click\decorators.py", line 73, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "c:\users\admin\desktop\flask\env\lib\site-packages\click\core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "c:\users\admin\desktop\flask\env\lib\site-packages\flask\cli.py", line 852, in run_command
    run_simple(
  File "c:\users\admin\desktop\flask\env\lib\site-packages\werkzeug\serving.py", line 1052, in run_simple
    inner()
  File "c:\users\admin\desktop\flask\env\lib\site-packages\werkzeug\serving.py", line 996, in inner
    srv = make_server(
  File "c:\users\admin\desktop\flask\env\lib\site-packages\werkzeug\serving.py", line 847, in make_server
    return ThreadedWSGIServer(
  File "c:\users\admin\desktop\flask\env\lib\site-packages\werkzeug\serving.py", line 740, in __init__
    HTTPServer.__init__(self, server_address, handler)
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python38-32\lib\socketserver.py", line 452, in __init__
    self.server_bind()
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python38-32\lib\http\server.py", line 140, in server_bind
    self.server_name = socket.getfqdn(host)
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python38-32\lib\socket.py", line 756, in getfqdn
    hostname, aliases, ipaddrs = gethostbyaddr(name)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xcf in position 6: invalid continuation byte
Gino Mempin
  • 25,369
  • 29
  • 96
  • 135
LYAGUSHKA
  • 1
  • 3
  • 1
    Sounds like your editor is using UTF8 encoding. Maybe try putting `# encoding: utf-8` at the top of your script? – h0r53 Oct 02 '20 at 18:34

1 Answers1

0

Found the problem. I just have cyrilic signs in computer name

LYAGUSHKA
  • 1
  • 3