Python run.py/UnicodeDecodeError

I’m trying to run the following step and I get this error.
Does anyone else has the same issue?

python run.py

  • Restarting with stat
  • Debugger is active!
  • Debugger PIN: 294-228-588
    Exception in thread Thread-1:
    Traceback (most recent call last):
    File “C:\python\Anaconda3\lib\threading.py”, line 917, in _bootstrap_inner
    self.run()
    File “C:\python\Anaconda3\lib\threading.py”, line 865, in run
    self._target(*self._args, **self._kwargs)
    File “C:\python\Anaconda3\lib\site-packages\werkzeug\serving.py”, line 774, in inner
    fd=fd)
    File “C:\python\Anaconda3\lib\site-packages\werkzeug\serving.py”, line 666, in make_server
    passthrough_errors, ssl_context, fd=fd)
    File “C:\python\Anaconda3\lib\site-packages\werkzeug\serving.py”, line 577, in init
    self.address_family), handler)
    File “C:\python\Anaconda3\lib\socketserver.py”, line 452, in init
    self.server_bind()
    File “C:\python\Anaconda3\lib\http\server.py”, line 139, in server_bind
    self.server_name = socket.getfqdn(host)
    File “C:\python\Anaconda3\lib\socket.py”, line 676, in getfqdn
    hostname, aliases, ipaddrs = gethostbyaddr(name)
    UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0xc1 in position 0: invalid start byte

Hi @Christos_28852,

Please share your .ini file contents so that we can debug the issue.

Kanika

Hi Kanika and thanks for your prompt repsonse,

Below is my .ini records.

Ticket: Connection

Rename this file to .ini after filling in your MFLIX_DB_URI and your SECRET_KEY

Do not surround the URI with quotes

[PROD]
SECRET_KEY = rhdfhfghrynyuyghnfgnytujtyukytukgdfjhghfgjkldskfdkjgojkslkjfkj
MFLIX_DB_URI = mongodb://m220student:{password}@mflix-shard-00-00-a9xlg.mongodb.net:27017,mflix-shard-00-01-a9xlg.mongodb.net:27017,mflix-shard-00-02-a9xlg.mongodb.net:27017/admin?replicaSet=mflix-shard-0&ssl=true

[TEST]
SECRET_KEY = asgwergrthebrebvdfbyj67u4rhewrtertdfdhdghrtyjryuj758i8i5ythrefbfbgdhhh
MFLIX_DB_URI = mongodb://m220student:{password}@mflix-shard-00-00-a9xlg.mongodb.net:27017,mflix-shard-00-01-a9xlg.mongodb.net:27017,mflix-shard-00-02-a9xlg.mongodb.net:27017/admin?replicaSet=mflix-shard-0&ssl=true


I’m not using the SRV version since I’m getting dns error.

mongo “mongodb+srv://m220student:{password}@mflix-a9xlg.mongodb.net/test?retryWrites=true”

DNSHostNotFound: Failed to look up service “”:╬Σ╧Ζ╧Ε╬χ ╬╖ ╬╗╬╡╬╣╧Ε╬┐╧Ζ╧Β╬│╬ψ╬▒ ╬╡╧Α╬╣╧Δ╧Ε╧Β╬υ╧Η╬╖╬║╬╡ ╬╡╧Α╬╡╬╣╬┤╬χ ╬φ╬╗╬╖╬╛╬╡ ╬╖ ╧Α╬╡╧Β╬ψ╬┐╬┤╬┐╧Γ ╧Ε╬┐╧Ζ ╧Θ╧Β╬┐╬╜╬╣╬║╬┐╧Ξ ╬┐╧Β╬ψ╬┐╧Ζ.
try ‘mongo --help’ for more information

Also have in mind that the test connection step performed successfully

pytest -m connection
============================= test session starts =============================
platform win32 – Python 3.7.3, pytest-3.3.0, py-1.8.0, pluggy-0.6.0
rootdir: C:\Python\M002\mflix-python, inifile:
plugins: remotedata-0.3.1, openfiles-0.3.2, flask-0.10.0, doctestplus-0.3.0, arraydiff-0.3
collected 43 items

tests\test_db_connection.py … [100%]

============================= 39 tests deselected =============================
================== 4 passed, 39 deselected in 10.55 seconds ===================

thanks again for your time

Hi again,

I solved both of my problems.

DNSHostNotFound issue solved by setting manually the dns entries. I set the google ones ( DNS Servers . . . . . . . . . . . : 8.8.8.8
8.8.4.4)

UnicodeDecodeError issue was due to my PC name. There were some greek character in the pc-name causing this issue. After replacing them with the english ones the problem solved.

1 Like