Python sqlite3 connect with special characters in path
<p>I have an application that is compiled with PyInstaller that uses a sqlite database. Everything works fine until a user with special characters in their name runs the software. Even simple code like this:</p>

<pre><code>import sqlite3
path = "C:\\Users\\Jøen\\test.db"

db = sqlite3.connect(path)
</code></pre>

<p>Results in a traceback:</p>

<pre><code>Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
sqlite3.OperationalError: unable to open database file
</code></pre>

<p>I have tried all kinds of combinations including using <code>chardet</code> to detect the encoding and then converting to UTF-8 but that didn't work either. All of my usual Python encoding/decoding tricks are failing me at this point. </p>

<p>Has anyone successfully opened a SQLite DB in Python that has special characters in a path? </p>

<p>So if any of you have international or special characters in your user path, some test code to potentially help me:</p>

<pre><code>import os
import sqlite3
path = os.path.expanduser("~")
sqlite3.connect(path + "\\test.db")
</code></pre>