summaryrefslogtreecommitdiff
path: root/coverage/sqldata.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2018-09-02 16:00:06 -0400
committerNed Batchelder <ned@nedbatchelder.com>2018-09-02 21:35:43 -0400
commitd7b20337e091075198c9c1efd726a9ac71957b26 (patch)
tree227a5c805b1ddf1d5a0960227a5a63c083ce891c /coverage/sqldata.py
parent66fdf66e8bd9e77ef3a4c2616bfa4edf4cbe5cb5 (diff)
downloadpython-coveragepy-git-d7b20337e091075198c9c1efd726a9ac71957b26.tar.gz
SQLite on py2 doesn't like opening files with non-ascii chars in the path
Diffstat (limited to 'coverage/sqldata.py')
-rw-r--r--coverage/sqldata.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/coverage/sqldata.py b/coverage/sqldata.py
index c120d82e..91508586 100644
--- a/coverage/sqldata.py
+++ b/coverage/sqldata.py
@@ -414,7 +414,11 @@ class Sqlite(SimpleRepr):
self.nest = 0
def connect(self):
- self.con = sqlite3.connect(self.filename)
+ # SQLite on Windows on py2 won't open a file if the filename argument
+ # has non-ascii characters in it. Opening a relative file name avoids
+ # a problem if the current directory has non-ascii.
+ filename = os.path.relpath(self.filename)
+ self.con = sqlite3.connect(filename)
# This pragma makes writing faster. It disables rollbacks, but we never need them.
# PyPy needs the .close() calls here, or sqlite gets twisted up: