From cbd50af302e618dbf21b2a7e5f273c961913d729 Mon Sep 17 00:00:00 2001 From: Brett Smith Date: Mon, 6 Apr 2020 15:21:15 -0400 Subject: [PATCH] rtutil: Explicit fspath cast to avoid a Py3.6 typecheck issue. On Py3.6, either sqlite3.connect() doesn't take a path-like object, or the type stubs don't know that. --- conservancy_beancount/rtutil.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/conservancy_beancount/rtutil.py b/conservancy_beancount/rtutil.py index 509631a..a0173ba 100644 --- a/conservancy_beancount/rtutil.py +++ b/conservancy_beancount/rtutil.py @@ -16,6 +16,7 @@ import functools import mimetypes +import os import re import sqlite3 import urllib.parse as urlparse @@ -73,7 +74,7 @@ class RTLinkCache(_LinkCache): @classmethod def setup(cls, cache_path: Path) -> Optional[sqlite3.Connection]: try: - db = sqlite3.connect(cache_path, isolation_level=None) + db = sqlite3.connect(os.fspath(cache_path), isolation_level=None) cursor = db.cursor() cursor.execute(cls.CREATE_TABLE_SQL) cursor.execute('SELECT url FROM RTLinkCache LIMIT 1')