expectocode / telegram-export

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

Exception when downloading document #102

Open onsails opened 5 years ago

onsails commented 5 years ago
python /Users/wb/anaconda3/bin/telegram-export --config-file config.ini
2019-01-02 14:29:43,297 - exporter - INFO - Saving to /Users/wb/tg-export
2019-01-02 14:29:43,437 - telegram_export.downloader - INFO - Getting participants...
2019-01-02 14:29:43,440 - asyncio - ERROR - Task exception was never retrieved
future: <Task finished coro=<Downloader._media_consumer() done, defined at /Users/wb/anaconda3/lib/python3.6/site-packages/telegram_export/downloader.py:305> exception=TypeError("__init__() missing 1 required positional argument: 'file_reference'",)>
Traceback (most recent call last):
  File "/Users/wb/anaconda3/lib/python3.6/site-packages/telegram_export/downloader.py", line 311, in _media_consumer
    bar)
  File "/Users/wb/anaconda3/lib/python3.6/site-packages/telegram_export/downloader.py", line 277, in _download_media
    secret=media_row[2]
TypeError: __init__() missing 1 required positional argument: 'file_reference'
2019-01-02 14:29:43,644 - telegram_export.downloader - INFO - Saved 0 new members, 0 left the chat.
2019-01-02 14:29:43,645 - telegram_export.downloader - INFO - Resuming at 1523913835 (61617)
2019-01-02 14:29:43,884 - exporter - INFO - Closing exporter
My chat: 187 messages [00:00, 414.97 messages/s]Traceback (most recent call last):█████████████████████████████████████| 7/7 [00:00<00:00, 15.71 entities/s, chat=My chat]
  File "/Users/wb/anaconda3/bin/telegram-export", line 2, in <module>
    runpy.run_module("telegram_export", run_name="__main__", alter_sys=True)
  File "/Users/wb/anaconda3/lib/python3.6/runpy.py", line 205, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)
  File "/Users/wb/anaconda3/lib/python3.6/runpy.py", line 96, in _run_module_code
    mod_name, mod_spec, pkg_name, script_name)
  File "/Users/wb/anaconda3/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/Users/wb/anaconda3/lib/python3.6/site-packages/telegram_export/__main__.py", line 316, in <module>
    ret = loop.run_until_complete(main(loop)) or 0
  File "/Users/wb/anaconda3/lib/python3.6/asyncio/base_events.py", line 468, in run_until_complete
    return future.result()
  File "/Users/wb/anaconda3/lib/python3.6/site-packages/telegram_export/__main__.py", line 300, in main
    await exporter.start()
  File "/Users/wb/anaconda3/lib/python3.6/site-packages/telegram_export/exporter.py", line 73, in start
    await self.downloader.start(entity)
  File "/Users/wb/anaconda3/lib/python3.6/site-packages/telegram_export/downloader.py", line 497, in start
    self._dump_messages(history.messages, target)
  File "/Users/wb/anaconda3/lib/python3.6/site-packages/telegram_export/downloader.py", line 136, in _dump_messages
    media_id = self.dumper.dump_media(m.media)
  File "/Users/wb/anaconda3/lib/python3.6/site-packages/telegram_export/dumper.py", line 539, in dump_media
    row['volume_id'] = doc.version
AttributeError: 'Document' object has no attribute 'version'
Lonami commented 5 years ago

You installed telethon==1.5 and the library only works with telethon~=1.4.3, but I believe we need to push the change to PyPi.

lorddusk commented 5 years ago

Even when changing to telethon 1.4.3 I still get an error

2019-01-02 16:22:09,172 - telegram_export.downloader - INFO - Getting participants... 2019-01-02 16:22:09,580 - asyncio - ERROR - Task exception was never retrieved future: <Task finished coro=<Downloader._media_consumer() done, defined at /usr/local/lib/python3.5/dist-packages/telegram_export/downloader.py:305> exception=OSError(22,'Invalid argument')> Traceback (most recent call last): File "/usr/lib/python3.5/asyncio/tasks.py", line 239, in _step result = coro.send(None) File "/usr/local/lib/python3.5/dist-packages/telegram_export/downloader.py", line 311, in _media_consumer bar) File "/usr/local/lib/python3.5/dist-packages/telegram_export/downloader.py", line 301, in _download_media progress_callback=progress File "/home/tlan/.local/lib/python3.5/site-packages/telethon/client/downloads.py", line 212, in download_file f = open(file, 'wb') OSError: [Errno 22] Invalid argument: '/mnt/c/Temp/Telegram/usermedia/November Sierra Delta Hotel Papa/photo/2018-10-11 19:14:52+00:00.60.jpg'

expectocode commented 5 years ago

Looks like the filename sanitisation bug. By the way, the Telethon version specifier is now on PyPI, so that shouldn't happen again.