From d7b20337e091075198c9c1efd726a9ac71957b26 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sun, 2 Sep 2018 16:00:06 -0400 Subject: SQLite on py2 doesn't like opening files with non-ascii chars in the path --- coverage/sqldata.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'coverage/sqldata.py') 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: -- cgit v1.2.1