summaryrefslogtreecommitdiff
path: root/coverage/sqldata.py
diff options
context:
space:
mode:
Diffstat (limited to 'coverage/sqldata.py')
-rw-r--r--coverage/sqldata.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/coverage/sqldata.py b/coverage/sqldata.py
index 56468e64..01f5ce01 100644
--- a/coverage/sqldata.py
+++ b/coverage/sqldata.py
@@ -979,7 +979,14 @@ class SqliteDb(SimpleReprMixin):
# 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)
+ try:
+ filename = os.path.relpath(self.filename)
+ except ValueError:
+ # ValueError can be raised under Windows when os.getcwd() returns a
+ # folder from a different drive than the drive of self.filename in
+ # which case we keep the original value of self.filename unchanged,
+ # hoping that we won't face the non-ascii directory problem.
+ filename = self.filename
# It can happen that Python switches threads while the tracer writes
# data. The second thread will also try to write to the data,
# effectively causing a nested context. However, given the idempotent