diff --git a/telebot/asyncio_storage/pickle_storage.py b/telebot/asyncio_storage/pickle_storage.py index 49fe3be..cf446d8 100644 --- a/telebot/asyncio_storage/pickle_storage.py +++ b/telebot/asyncio_storage/pickle_storage.py @@ -28,7 +28,7 @@ class StatePickleStorage(StateStorageBase): """ Create directory .save-handlers. """ - dirs = self.file_path.rsplit('/', maxsplit=1)[0] + dirs, filename = os.path.split(self.file_path) os.makedirs(dirs, exist_ok=True) if not os.path.isfile(self.file_path): with open(self.file_path,'wb') as file: diff --git a/telebot/storage/pickle_storage.py b/telebot/storage/pickle_storage.py index dfffcf8..68c9fbe 100644 --- a/telebot/storage/pickle_storage.py +++ b/telebot/storage/pickle_storage.py @@ -34,7 +34,7 @@ class StatePickleStorage(StateStorageBase): """ Create directory .save-handlers. """ - dirs = self.file_path.rsplit('/', maxsplit=1)[0] + dirs, filename = os.path.split(self.file_path) os.makedirs(dirs, exist_ok=True) if not os.path.isfile(self.file_path): with open(self.file_path,'wb') as file: