Cast Paths to string: pathlib for older pythons doesn't properly work

This commit is contained in:
Dan 2019-06-20 14:15:02 +02:00
parent 48197cb222
commit 9ebf2983fe
3 changed files with 4 additions and 4 deletions

View File

@ -990,7 +990,7 @@ class Client(Methods, BaseClient):
def load_config(self): def load_config(self):
parser = ConfigParser() parser = ConfigParser()
parser.read(self.config_file) parser.read(str(self.config_file))
if self.api_id and self.api_hash: if self.api_id and self.api_hash:
pass pass

View File

@ -77,7 +77,7 @@ class FileStorage(MemoryStorage):
if file_exists: if file_exists:
try: try:
with open(path, encoding="utf-8") as f: with open(str(path), encoding="utf-8") as f:
session_json = json.load(f) session_json = json.load(f)
except ValueError: except ValueError:
pass pass
@ -98,7 +98,7 @@ class FileStorage(MemoryStorage):
log.warning('Old session file detected: "{}.OLD". You can remove this file now'.format(path.name)) log.warning('Old session file detected: "{}.OLD". You can remove this file now'.format(path.name))
self.conn = sqlite3.connect( self.conn = sqlite3.connect(
path, str(path),
timeout=1, timeout=1,
check_same_thread=False check_same_thread=False
) )

View File

@ -46,7 +46,7 @@ class MemoryStorage(Storage):
def create(self): def create(self):
with self.lock, self.conn: with self.lock, self.conn:
with open(Path(__file__).parent / "schema.sql", "r") as schema: with open(str(Path(__file__).parent / "schema.sql"), "r") as schema:
self.conn.executescript(schema.read()) self.conn.executescript(schema.read())
self.conn.execute( self.conn.execute(