expectocode / telegram-export

Export Telegram chat data and history
Mozilla Public License 2.0
460 stars 95 forks source link

struct.error: 'i' format requires -2147483648 <= number <= 2147483647 100%|█ #27

Closed nobody16 closed 6 years ago

nobody16 commented 6 years ago

Files are not downloaded correctly:

python3 telegram_export.py
2018-03-04 10:26:24,630 - downloader - INFO - Getting participants...
📺 Aventuras [PALOMITAS]: 713 messages [00:00, 393802.84 messages/s]
2018-03-04 10:26:24,751 - downloader - INFO - Getting participants aborted (not admin).                          | 0/1 [00:00/?, ? entities/s, chat=📺 Aventuras [PALOMITAS]📺 Aventuras [PALOMITAS]: 713 messages [00:00, 5811.63 messages/s]
2018-03-04 10:26:25,098 - downloader - DEBUG - Received less messages than limit, done.██████████████████| 1/1 [00:00/00:00,  8.17 entities/s, chat=📺 Aventuras [PALOMITAS]📺 Aventuras [PALOMITAS]: 813 messages [00:00, 212.94 messages/s]
100%|████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00/00:00,  2.13 entities/s, chat=📺 Aventuras [PALOMITAS]2018-03-04 10:26:25,104 - downloader - INFO - Done. Retrieving full information about 0 missing entities.
100%|████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00/00:00,  2.10 entities/s, chat=📺 Aventuras [PALOMITAS]2018-03-04 10:26:25,104 - asyncio - ERROR - Task exception was never retrieved
future: <Task finished coro=<Downloader._media_consumer() done, defined at /video/backup_telegram/telegram-export/downloader.py:150> exception=error("'i' format requires -2147483648 <= number <= 2147483647",)>
Traceback (most recent call last):
  File "/video/backup_telegram/telegram-export/downloader.py", line 174, in _media_consumer
    progress_callback=progress
  File "/usr/local/lib/python3.6/dist-packages/telethon/telegram_client.py", line 1886, in download_file
    input_location, offset, part_size
  File "/usr/local/lib/python3.6/dist-packages/telethon/telegram_bare_client.py", line 424, in __call__
    result = await self._invoke(call_receive, retry, *requests)
  File "/usr/local/lib/python3.6/dist-packages/telethon/telegram_bare_client.py", line 468, in _invoke
    await self._sender.send(*requests)
  File "/usr/local/lib/python3.6/dist-packages/telethon/network/mtproto_sender.py", line 110, in send
    await self._send_message(message)
  File "/usr/local/lib/python3.6/dist-packages/telethon/network/mtproto_sender.py", line 165, in _send_message
    await self.connection.send(utils.pack_message(self.session, message))
  File "/usr/local/lib/python3.6/dist-packages/telethon/helpers.py", line 33, in pack_message
    data = struct.pack('<qq', session.salt, session.id) + bytes(message)
  File "/usr/local/lib/python3.6/dist-packages/telethon/tl/tl_message.py", line 25, in __bytes__
    body = GzipPacked.gzip_if_smaller(self.request)
  File "/usr/local/lib/python3.6/dist-packages/telethon/tl/gzip_packed.py", line 22, in gzip_if_smaller
    data = bytes(request)
  File "/usr/local/lib/python3.6/dist-packages/telethon/tl/functions/upload.py", line 121, in __bytes__
    bytes(self.location),
  File "/usr/local/lib/python3.6/dist-packages/telethon/tl/types/__init__.py", line 6556, in __bytes__
    struct.pack('<i', self.version),
struct.error: 'i' format requires -2147483648 <= number <= 2147483647
100%|████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00/00:00,  1.85 entities/s, chat=📺 Aventuras [PALOMITAS]
expectocode commented 6 years ago

Sounds like it might be a Telethon bug

Lonami commented 6 years ago

No, probably using the wrong field when constructing back the original InputDocumentFileLocation.