aahnik / tgcf

The ultimate tool to automate custom telegram message forwarding. Live-syncer, Auto-poster, backup-bot, cloner, chat-forwarder, duplicator, ... Call it whatever you like! tgcf can fulfill your custom needs.
https://github.com/aahnik/tgcf/wiki
MIT License
1.31k stars 783 forks source link

**Error: Incorrect padding** can't run in docker #354

Closed azlk closed 1 year ago

azlk commented 2 years ago

Describe the bug After pulling image and creating tgcf.yml and .env files I tried to start image like this: docker run -v /home/tgcf/tgcf.config.yml:/app/tgcf.config.yml --env-file /home/tgcf/.env aahnik/tgcf and got this: Error: Incorrect padding I don't understand why running tgcf shows Python 3.9.5, while I don't have it installed here... Maybe this is from docker container?...

To Reproduce Steps to reproduce the behavior:

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots and gifs to help explain your problem.

System information: In which OS are you running? GIve all details of where you have deployed the application. Make sure to give detailed version information. _root@vbr:/home/tgcf# uname -a Linux vbr 5.4.0-91-generic #102-Ubuntu SMP Fri Nov 5 16:31:28 UTC 2021 x86_64 x86_64 x8664 GNU/Linux root@vbr:/home/tgcf# python3 --version Python 3.8.10

Additional context Add any other context about the problem here.

[12/30/21 09:45:53] INFO Verbosity turned on! This is suitable for cli.py:72 debugging
INFO Running tgcf 0.2.11 cli.py:74 Python 3.9.5 (default, May 4 2021,
18:33:52) [GCC 10.2.1 20201203]
OS posix
Platform Linux 5.4.0-91-generic
('64bit', '')
INFO Failed to load SSL library: <class libssl.py:79 'OSError'> (no library called "ssl"
found)
[12/30/21 09:45:54] INFO tgcf.config.yml detected config.py:73 ╭───────────────────── Traceback (most recent call last) ──────────────────────╮ │ /venv/bin/tgcf:8 in │ │ │ │ 5 from tgcf.cli import app │ │ 6 if name == 'main': │ │ 7 │ sys.argv[0] = re.sub(r'(-script.pyw|.exe)?$', '', sys.argv[0]) │ │ ❱ 8 │ sys.exit(app()) │ │ 9 │ │ │ │ /venv/lib/python3.9/site-packages/typer/main.py:214 in call │ │ │ │ 211 │ │ ) │ │ 212 │ │ │ 213 │ def call(self, *args: Any, kwargs: Any) -> Any: │ │ ❱ 214 │ │ return get_command(self)(*args, *kwargs) │ │ 215 │ │ 216 │ │ 217 def get_group(typer_instance: Typer) -> click.Command: │ │ │ │ /venv/lib/python3.9/site-packages/click/core.py:829 in call │ │ │ │ 826 │ │ │ 827 │ def call(self, args, kwargs): │ │ 828 │ │ """Alias for :meth:main.""" │ │ ❱ 829 │ │ return self.main(*args, kwargs) │ │ 830 │ │ 831 │ │ 832 class Command(BaseCommand): │ │ │ │ /venv/lib/python3.9/site-packages/click/core.py:782 in main │ │ │ │ 779 │ │ try: │ │ 780 │ │ │ try: │ │ 781 │ │ │ │ with self.make_context(prog_name, args, extra) as c │ │ ❱ 782 │ │ │ │ │ rv = self.invoke(ctx) │ │ 783 │ │ │ │ │ if not standalone_mode: │ │ 784 │ │ │ │ │ │ return rv │ │ 785 │ │ │ │ │ # it's not safe to ctx.exit(rv) here! │ │ │ │ /venv/lib/python3.9/site-packages/click/core.py:1066 in invoke │ │ │ │ 1063 │ │ """ │ │ 1064 │ │ _maybe_show_deprecated_notice(self) │ │ 1065 │ │ if self.callback is not None: │ │ ❱ 1066 │ │ │ return ctx.invoke(self.callback, ctx.params) │ │ 1067 │ │ 1068 │ │ 1069 class MultiCommand(Command): │ │ │ │ /venv/lib/python3.9/site-packages/click/core.py:610 in invoke │ │ │ │ 607 │ │ args = args[2:] │ │ 608 │ │ with augment_usage_errors(self): │ │ 609 │ │ │ with ctx: │ │ ❱ 610 │ │ │ │ return callback(*args, *kwargs) │ │ 611 │ │ │ 612 │ def forward(args, kwargs): # noqa: B902 │ │ 613 │ │ """Similar to :meth:invoke but fills in default keyword │ │ │ │ /venv/lib/python3.9/site-packages/typer/main.py:497 in wrapper │ │ │ │ 494 │ │ │ │ use_params[k] = v │ │ 495 │ │ if context_param_name: │ │ 496 │ │ │ use_params[context_param_name] = click.get_current_context │ │ ❱ 497 │ │ return callback(*use_params) # type: ignore │ │ 498 │ │ │ 499 │ update_wrapper(wrapper, callback) │ │ 500 │ return wrapper │ │ │ │ /venv/lib/python3.9/site-packages/tgcf/cli.py:137 in main │ │ │ │ 134 │ │ │ │ 135 │ │ asyncio.run(forward_job()) │ │ 136 │ else: │ │ ❱ 137 │ │ from tgcf.live import start_sync # pylint: disable=import-out │ │ 138 │ │ │ │ 139 │ │ asyncio.run(start_sync()) │ │ 140 │ │ │ │ /venv/lib/python3.9/site-packages/tgcf/live.py:9 in │ │ │ │ 6 from telethon import TelegramClient, events, functions, types │ │ 7 from telethon.tl.custom.message import Message │ │ 8 │ │ ❱ 9 from tgcf import config, const │ │ 10 from tgcf import storage as st │ │ 11 from tgcf.bot import get_events │ │ 12 from tgcf.plugins import apply_plugins │ │ │ │ /venv/lib/python3.9/site-packages/tgcf/config.py:143 in │ │ │ │ 140 BOT_TOKEN = get_env_var("BOT_TOKEN", optional=True) │ │ 141 │ │ 142 if SESSION_STRING: │ │ ❱ 143 │ SESSION = StringSession(SESSION_STRING) │ │ 144 elif BOT_TOKEN: │ │ 145 │ SESSION = "tgcf_bot" │ │ 146 else: │ │ │ │ /venv/lib/python3.9/site-packages/telethon/sessions/string.py:38 in init │ │ │ │ 35 │ │ │ string = string[1:] │ │ 36 │ │ │ ip_len = 4 if len(string) == 352 else 16 │ │ 37 │ │ │ self._dc_id, ip, self._port, key = struct.unpack( │ │ ❱ 38 │ │ │ │ _STRUCT_PREFORMAT.format(ip_len), StringSession.decode( │ │ 39 │ │ │ │ │ 40 │ │ │ self._server_address = ipaddress.ip_address(ip).compressed │ │ 41 │ │ │ if any(key): │ │ │ │ /venv/lib/python3.9/site-packages/telethon/sessions/string.py:50 in decode │ │ │ │ 47 │ │ │ 48 │ @staticmethod │ │ 49 │ def decode(x: str) -> bytes: │ │ ❱ 50 │ │ return base64.urlsafe_b64decode(x) │ │ 51 │ │ │ 52 │ def save(self: Session): │ │ 53 │ │ if not self.auth_key: │ │ │ │ /usr/local/lib/python3.9/base64.py:133 in urlsafe_b64decode │ │ │ │ 130 │ """ │ │ 131 │ s = _bytes_from_decode_data(s) │ │ 132 │ s = s.translate(_urlsafe_decode_translation) │ │ ❱ 133 │ return b64decode(s) │ │ 134 │ │ 135 │ │ 136 │ │ │ │ /usr/local/lib/python3.9/base64.py:87 in b64decode │ │ │ │ 84 │ │ s = s.translate(bytes.maketrans(altchars, b'+/')) │ │ 85 │ if validate and not re.fullmatch(b'[A-Za-z0-9+/]={0,2}', s): │ │ 86 │ │ raise binascii.Error('Non-base64 digit found') │ │ ❱ 87 │ return binascii.a2b_base64(s) │ │ 88 │ │ 89 │ │ 90 def standard_b64encode(s): │ ╰──────────────────────────────────────────────────────────────────────────────╯ Error: Incorrect padding