Skip to content

Commit a5c2689

Browse files
committed
remove pickle persistence file if could not load it, update requirements
1 parent 7e445de commit a5c2689

File tree

7 files changed

+209
-204
lines changed

7 files changed

+209
-204
lines changed

poetry.lock

Lines changed: 168 additions & 179 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ scdlbot = "scdlbot.__main__:main"
4242

4343
[tool.poetry.dependencies]
4444
python = "^3.10"
45-
python-telegram-bot = { version = "21.6", extras = ["webhooks", "job-queue", "http2", "rate-limiter"] }
45+
python-telegram-bot = { version = "21.7", extras = ["webhooks", "job-queue", "http2", "rate-limiter"] }
4646
#ptbcontrib = { git = "https://github.com/python-telegram-bot/ptbcontrib.git", branch = "main", extras = ["postgres-persistence"] }
4747
# https://python-poetry.org/docs/dependency-specification#path-dependencies
4848
#ptbcontrib = { path = "../ptbcontrib/", develop = false }
4949
requests = { version = "^2.31.0", extras = ["socks"] }
5050
pebble = "^5.0.7"
51-
boltons = "^24.0.0"
51+
boltons = "^24.1.0"
5252
mutagen = "^1.47.0"
5353
plumbum = "^1.9.0"
5454
ffmpeg-python = "0.2.0"
@@ -112,7 +112,7 @@ sphinx-autodoc-typehints = "^2.3.0"
112112
# https://github.com/CrossNox/m2r2/pull/69
113113
#m2r2 = { git = "https://github.com/adrien-berchet/m2r2.git", branch = "patch-1" }
114114
myst-parser = "^4.0.0"
115-
tomli = "^2.0"
115+
tomli = "^2.1"
116116
recommonmark = "^0.7"
117117
typing-extensions = "^4.9"
118118

requirements-dev.txt

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ darglint==1.8.1 ; python_version >= "3.10" and python_version < "4.0"
1717
dictdiffer==0.9.0 ; python_version >= "3.10" and python_version < "4.0"
1818
doc8==1.1.2 ; python_version >= "3.10" and python_version < "4.0"
1919
docutils==0.21.2 ; python_version >= "3.10" and python_version < "4.0"
20-
dparse==0.6.4b0 ; python_version >= "3.10" and python_version < "4.0"
20+
dparse==0.6.4 ; python_version >= "3.10" and python_version < "4.0"
2121
dpath==2.2.0 ; python_version >= "3.10" and python_version < "4.0"
2222
eradicate==2.3.0 ; python_version >= "3.10" and python_version < "4.0"
2323
exceptiongroup==1.2.2 ; python_version >= "3.10" and python_version < "3.11"
2424
filelock==3.12.4 ; python_version >= "3.10" and python_version < "4.0"
2525
flake8-bandit==4.1.1 ; python_version >= "3.10" and python_version < "4.0"
2626
flake8-broken-line==1.0.0 ; python_version >= "3.10" and python_version < "4.0"
27-
flake8-bugbear==24.8.19 ; python_version >= "3.10" and python_version < "4.0"
27+
flake8-bugbear==24.10.31 ; python_version >= "3.10" and python_version < "4.0"
2828
flake8-commas==2.1.0 ; python_version >= "3.10" and python_version < "4.0"
2929
flake8-comprehensions==3.16.0 ; python_version >= "3.10" and python_version < "4.0"
3030
flake8-debugger==4.1.2 ; python_version >= "3.10" and python_version < "4.0"
@@ -38,7 +38,7 @@ flake8==7.1.1 ; python_version >= "3.10" and python_version < "4.0"
3838
flatten-dict==0.4.2 ; python_version >= "3.10" and python_version < "4.0"
3939
furl==2.1.3 ; python_version >= "3.10" and python_version < "4.0"
4040
gitignore-parser==0.1.11 ; python_version >= "3.10" and python_version < "4.0"
41-
identify==2.6.1 ; python_version >= "3.10" and python_version < "4.0"
41+
identify==2.6.2 ; python_version >= "3.10" and python_version < "4.0"
4242
idna==3.10 ; python_version >= "3.10" and python_version < "4.0"
4343
isort==5.13.2 ; python_version >= "3.10" and python_version < "4.0"
4444
jinja2==3.1.4 ; python_version >= "3.10" and python_version < "4.0"
@@ -47,14 +47,14 @@ loguru==0.7.2 ; python_version >= "3.10" and python_version < "4.0"
4747
markdown-it-py==3.0.0 ; python_version >= "3.10" and python_version < "4.0"
4848
markupsafe==3.0.2 ; python_version >= "3.10" and python_version < "4.0"
4949
marshmallow-polyfield==5.11 ; python_version >= "3.10" and python_version < "4.0"
50-
marshmallow==3.23.0 ; python_version >= "3.10" and python_version < "4.0"
50+
marshmallow==3.23.1 ; python_version >= "3.10" and python_version < "4.0"
5151
mccabe==0.7.0 ; python_version >= "3.10" and python_version < "4.0"
5252
mdurl==0.1.2 ; python_version >= "3.10" and python_version < "4.0"
5353
more-itertools==10.5.0 ; python_version >= "3.10" and python_version < "4.0"
5454
mypy-extensions==1.0.0 ; python_version >= "3.10" and python_version < "4.0"
5555
nitpick==0.35.0 ; python_version >= "3.10" and python_version < "4.0"
5656
orderedmultidict==1.0.1 ; python_version >= "3.10" and python_version < "4.0"
57-
packaging==24.1 ; python_version >= "3.10" and python_version < "4.0"
57+
packaging==24.2 ; python_version >= "3.10" and python_version < "4.0"
5858
pathspec==0.12.1 ; python_version >= "3.10" and python_version < "4.0"
5959
pbr==6.1.0 ; python_version >= "3.10" and python_version < "4.0"
6060
pep8-naming==0.13.3 ; python_version >= "3.10" and python_version < "4.0"
@@ -63,8 +63,8 @@ pluggy==1.5.0 ; python_version >= "3.10" and python_version < "4.0"
6363
psutil==6.0.0 ; python_version >= "3.10" and python_version < "4.0"
6464
pycodestyle==2.12.1 ; python_version >= "3.10" and python_version < "4.0"
6565
pycparser==2.22 ; python_version >= "3.10" and python_version < "4.0" and platform_python_implementation != "PyPy"
66-
pydantic-core==2.14.6 ; python_version >= "3.10" and python_version < "4.0"
67-
pydantic==2.5.3 ; python_version >= "3.10" and python_version < "4.0"
66+
pydantic-core==2.23.4 ; python_version >= "3.10" and python_version < "4.0"
67+
pydantic==2.9.2 ; python_version >= "3.10" and python_version < "4.0"
6868
pydocstyle==6.3.0 ; python_version >= "3.10" and python_version < "4.0"
6969
pyflakes==3.2.0 ; python_version >= "3.10" and python_version < "4.0"
7070
pygments==2.18.0 ; python_version >= "3.10" and python_version < "4.0"
@@ -73,12 +73,12 @@ pyyaml==6.0.2 ; python_version >= "3.10" and python_version < "4.0"
7373
requests-cache==1.2.1 ; python_version >= "3.10" and python_version < "4.0"
7474
requests==2.32.3 ; python_version >= "3.10" and python_version < "4.0"
7575
restructuredtext-lint==1.4.0 ; python_version >= "3.10" and python_version < "4.0"
76-
rich==13.9.3 ; python_version >= "3.10" and python_version < "4.0"
76+
rich==13.9.4 ; python_version >= "3.10" and python_version < "4.0"
7777
ruamel-yaml-clib==0.2.12 ; platform_python_implementation == "CPython" and python_version < "3.13" and python_version >= "3.10"
7878
ruamel-yaml==0.18.6 ; python_version >= "3.10" and python_version < "4.0"
79-
safety-schemas==0.0.8 ; python_version >= "3.10" and python_version < "4.0"
80-
safety==3.2.10 ; python_version >= "3.10" and python_version < "4.0"
81-
setuptools==75.2.0 ; python_version >= "3.10" and python_version < "4.0"
79+
safety-schemas==0.0.9 ; python_version >= "3.10" and python_version < "4.0"
80+
safety==3.2.11 ; python_version >= "3.10" and python_version < "4.0"
81+
setuptools==75.5.0 ; python_version >= "3.10" and python_version < "4.0"
8282
shellingham==1.5.4 ; python_version >= "3.10" and python_version < "4.0"
8383
six==1.16.0 ; python_version >= "3.10" and python_version < "4.0"
8484
snowballstemmer==2.2.0 ; python_version >= "3.10" and python_version < "4.0"
@@ -87,9 +87,9 @@ stevedore==5.3.0 ; python_version >= "3.10" and python_version < "4.0"
8787
strenum==0.4.15 ; python_version >= "3.10" and python_version < "4.0"
8888
text-unidecode==1.3 ; python_version >= "3.10" and python_version < "4.0"
8989
toml==0.10.2 ; python_version >= "3.10" and python_version < "4.0"
90-
tomli==2.0.2 ; python_version >= "3.10" and python_version < "3.11"
90+
tomli==2.1.0 ; python_version >= "3.10" and python_version < "3.11"
9191
tomlkit==0.13.2 ; python_version >= "3.10" and python_version < "4.0"
92-
typer==0.12.5 ; python_version >= "3.10" and python_version < "4.0"
92+
typer==0.13.0 ; python_version >= "3.10" and python_version < "4.0"
9393
typing-extensions==4.12.2 ; python_version >= "3.10" and python_version < "4.0"
9494
url-normalize==1.4.3 ; python_version >= "3.10" and python_version < "4.0"
9595
urllib3==2.2.3 ; python_version >= "3.10" and python_version < "4.0"

requirements-docs.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ markupsafe==3.0.2 ; python_version >= "3.10" and python_version < "4.0"
1313
mdit-py-plugins==0.4.2 ; python_version >= "3.10" and python_version < "4.0"
1414
mdurl==0.1.2 ; python_version >= "3.10" and python_version < "4.0"
1515
myst-parser==4.0.0 ; python_version >= "3.10" and python_version < "4.0"
16-
packaging==24.1 ; python_version >= "3.10" and python_version < "4.0"
16+
packaging==24.2 ; python_version >= "3.10" and python_version < "4.0"
1717
pygments==2.18.0 ; python_version >= "3.10" and python_version < "4.0"
1818
pyyaml==6.0.2 ; python_version >= "3.10" and python_version < "4.0"
1919
recommonmark==0.7.1 ; python_version >= "3.10" and python_version < "4.0"
@@ -27,6 +27,6 @@ sphinxcontrib-htmlhelp==2.1.0 ; python_version >= "3.10" and python_version < "4
2727
sphinxcontrib-jsmath==1.0.1 ; python_version >= "3.10" and python_version < "4.0"
2828
sphinxcontrib-qthelp==2.0.0 ; python_version >= "3.10" and python_version < "4.0"
2929
sphinxcontrib-serializinghtml==2.0.0 ; python_version >= "3.10" and python_version < "4.0"
30-
tomli==2.0.2 ; python_version >= "3.10" and python_version < "4.0"
30+
tomli==2.1.0 ; python_version >= "3.10" and python_version < "4.0"
3131
typing-extensions==4.12.2 ; python_version >= "3.10" and python_version < "4.0"
3232
urllib3==2.2.3 ; python_version >= "3.10" and python_version < "4.0"

requirements.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ anyio==4.6.2.post1 ; python_version >= "3.10" and python_version < "4.0"
33
apscheduler==3.10.4 ; python_version >= "3.10" and python_version < "4.0"
44
bandcamp-downloader==0.0.16 ; python_version >= "3.10" and python_version < "4.0"
55
beautifulsoup4==4.13.0b2 ; python_version >= "3.10" and python_version < "4.0"
6-
boltons==24.0.0 ; python_version >= "3.10" and python_version < "4.0"
6+
boltons==24.1.0 ; python_version >= "3.10" and python_version < "4.0"
77
certifi==2024.8.30 ; python_version >= "3.10" and python_version < "4.0"
88
charset-normalizer==3.4.0 ; python_version >= "3.10" and python_version < "4.0"
99
colorama==0.4.6 ; python_version >= "3.10" and python_version < "4.0" and platform_system == "Windows"
@@ -18,7 +18,7 @@ future==1.0.0 ; python_version >= "3.10" and python_version < "4.0"
1818
h11==0.14.0 ; python_version >= "3.10" and python_version < "4.0"
1919
h2==4.1.0 ; python_version >= "3.10" and python_version < "4.0"
2020
hpack==4.0.0 ; python_version >= "3.10" and python_version < "4.0"
21-
httpcore==1.0.6 ; python_version >= "3.10" and python_version < "4.0"
21+
httpcore==1.0.7 ; python_version >= "3.10" and python_version < "4.0"
2222
httpx==0.27.2 ; python_version >= "3.10" and python_version < "4.0"
2323
httpx[http2]==0.27.2 ; python_version >= "3.10" and python_version < "4.0"
2424
hyperframe==6.0.1 ; python_version >= "3.10" and python_version < "4.0"
@@ -30,24 +30,24 @@ plumbum==1.9.0 ; python_version >= "3.10" and python_version < "4.0"
3030
prometheus-client==0.21.0 ; python_version >= "3.10" and python_version < "4.0"
3131
pysocks==1.7.1 ; python_version >= "3.10" and python_version < "4.0"
3232
python-dateutil==2.9.0.post0 ; python_version >= "3.10" and python_version < "4.0"
33-
python-telegram-bot[http2,job-queue,rate-limiter,webhooks]==21.6 ; python_version >= "3.10" and python_version < "4.0"
33+
python-telegram-bot[http2,job-queue,rate-limiter,webhooks]==21.7 ; python_version >= "3.10" and python_version < "4.0"
3434
pytz==2024.2 ; python_version >= "3.10" and python_version < "4.0"
3535
pywin32==308 ; platform_system == "Windows" and platform_python_implementation != "PyPy" and python_version >= "3.10" and python_version < "4.0"
3636
requests==2.32.3 ; python_version >= "3.10" and python_version < "4.0"
3737
requests[socks]==2.32.3 ; python_version >= "3.10" and python_version < "4.0"
38-
scdl @ git+https://github.com/scdl-org/scdl.git@9732b538db8ca5062df818eb3a17bed382b07941 ; python_version >= "3.10" and python_version < "4.0"
38+
scdl @ git+https://github.com/scdl-org/scdl.git@a433ac475fd1c45479466160b436b08aee779e21 ; python_version >= "3.10" and python_version < "4.0"
3939
sdnotify==0.3.2 ; python_version >= "3.10" and python_version < "4.0"
4040
six==1.16.0 ; python_version >= "3.10" and python_version < "4.0"
4141
sniffio==1.3.1 ; python_version >= "3.10" and python_version < "4.0"
4242
soundcloud-v2==1.6.0 ; python_version >= "3.10" and python_version < "4.0"
4343
soupsieve==2.6 ; python_version >= "3.10" and python_version < "4.0"
4444
termcolor==2.5.0 ; python_version >= "3.10" and python_version < "4.0"
4545
tornado==6.4.1 ; python_version >= "3.10" and python_version < "4.0"
46-
tqdm==4.66.6 ; python_version >= "3.10" and python_version < "4.0"
46+
tqdm==4.67.0 ; python_version >= "3.10" and python_version < "4.0"
4747
typing-extensions==4.12.2 ; python_version >= "3.10" and python_version < "4.0"
4848
tzdata==2024.2 ; python_version >= "3.10" and python_version < "4.0" and platform_system == "Windows"
4949
tzlocal==5.2 ; python_version >= "3.10" and python_version < "4.0"
5050
unicode-slugify==0.1.5 ; python_version >= "3.10" and python_version < "4.0"
5151
unidecode==1.3.8 ; python_version >= "3.10" and python_version < "4.0"
5252
urllib3==2.2.3 ; python_version >= "3.10" and python_version < "4.0"
53-
yt-dlp @ git+https://github.com/yt-dlp/yt-dlp.git@f101e5d34c97c608156ad5396714c2a2edca966a ; python_version >= "3.10" and python_version < "4.0"
53+
yt-dlp @ git+https://github.com/yt-dlp/yt-dlp.git@f9197295388b44ee0a8992cb00f361c7ef42acdb ; python_version >= "3.10" and python_version < "4.0"

scdlbot.service.sample

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ EnvironmentFile=/etc/default/scdlbot
2525
ExecStart=/usr/local/bin/scdlbot
2626
WatchdogSec=180
2727
#WatchdogSignal=SIGKILL
28-
KillMode=mixed
28+
#KillMode=mixed
2929
NotifyAccess=all
3030
Restart=always
3131
RestartSec=5

scdlbot/__main__.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import logging
77
import os
88
import pathlib
9+
import pickle
910
import platform
1011
import random
1112
import re
@@ -1436,6 +1437,21 @@ def main():
14361437
# with open(config_path, 'w') as config_file:
14371438
# config.write(config_file)
14381439

1440+
try:
1441+
with open(CHAT_STORAGE, "rb") as file:
1442+
data = pickle.load(file)
1443+
logger.info(f"Pickle file '{CHAT_STORAGE}' loaded successfully. Can continue loading persistence.")
1444+
except FileNotFoundError:
1445+
logger.info(f"The file '{CHAT_STORAGE}' does not exist, it will be created from scratch.")
1446+
except TypeError as e:
1447+
logger.info(f"TypeError occurred: {e}. Deleting the file...")
1448+
os.remove(CHAT_STORAGE)
1449+
logger.info(f"File '{CHAT_STORAGE}' has been deleted, it will be created from scratch.")
1450+
except Exception as e:
1451+
logger.info(f"An unexpected error occurred: {e}. Deleting the file...")
1452+
os.remove(CHAT_STORAGE)
1453+
logger.info(f"File '{CHAT_STORAGE}' has been deleted, it will be created from scratch.")
1454+
14391455
persistence = PicklePersistence(filepath=CHAT_STORAGE)
14401456

14411457
# https://docs.python-telegram-bot.org/en/v20.1/telegram.ext.applicationbuilder.html#telegram.ext.ApplicationBuilder

0 commit comments

Comments
 (0)