Encoding with 'idna' codec failed in RethinkDB
<p>I have a <code>flask</code> app that runs and connects to a remote <code>rethinkdb</code> database on <a href="https://www.compose.io" rel="nofollow">compose.io</a>. The app is also deployed to <a href="https://www.pythonanywhere.com" rel="nofollow">pythonanywhere.com</a>, but this deployment keeps throwing the following error:</p>

<pre><code>Traceback (most recent call last):
File "/home/user/.virtualenvs/venv/lib/python3.5/encodings/idna.py", line 165, in encode
    raise UnicodeError("label empty or too long")
UnicodeError: label empty or too long

...

rethinkdb.errors.ReqlDriverError: Could not connect to rethinkdb://[user]:[password]@aws-us-east-1-portal.1.dblayer.com:23232. Error: encoding with 'idna' codec failed (UnicodeError: label empty or too long)
</code></pre>

<p>The connection code looks exactly like this:</p>

<pre><code>conn = r.connect(host='aws-us-east-1-portal.1.dblayer.com',  
             port=23232,
             auth_key='[auth_key]',
             ssl={'ca_certs': './cacert'})
</code></pre>

<p>I'm not sure how to proceed from here.</p>

<p>Running Python 3.5.</p>