carderne / signal-export

Export your Signal chats to markdown files with attachments
Other
504 stars 54 forks source link

Export fails with stack trace #120

Closed hellnation76 closed 6 months ago

hellnation76 commented 7 months ago

First, thanks a lot for this tool. :)

It export all the files fine, however it seems to fail when trying to export the messages. (see trace)

any idea why? I installed python 3.12 from the ms store.

I had to ctrl+c to stop it as it just print errors for every messages. (I truncated the log file below)

--

C:\Users\Jos>python -m sigexport j:\Temp\MySignalExport44
Using Docker to extract data, this may take a while the first time!
Copying and renaming attachments
Creating output files
┌─────────────────────────────── Traceback (most recent call last) ────────────────────────────────┐
│ C:\Users\Jos\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCach │
│ e\local-packages\Python312\site-packages\sigexport\main.py:204 in main                           │
│                                                                                                  │
│   201 │   │   )                                                                                  │
│   202 │                                                                                          │
│   203 │   secho("Creating output files")                                                         │
│ > 204 │   chat_dict = create.create_chats(convos, contacts)                                      │
│   205 │                                                                                          │
│   206 │   if old:                                                                                │
│   207 │   │   secho(f"Merging old at {old} into output directory")                               │
│                                                                                                  │
│ ┌─────────────────────────────────────────── locals ───────────────────────────────────────────┐ │
│ │              _ = None                                                                        │ │
│ │        att_dst = WindowsPath('j:/Temp/MySignalExport44/J/media/2021-01-09T23-53-01.883_00_s… │ │
│ │        att_src = WindowsPath('C:/Users/Jos/AppData/Roaming/Signal/attachments.noindex/20/20… │ │
│ │          chats = ''                                                                          │ │
│ │            cmd = [                                                                           │ │
│ │                  │   'docker',                                                               │ │
│ │                  │   'run',                                                                  │ │
│ │                  │   '--rm',                                                                 │ │
│ │                  │   '--volume=C:\\Users\\Jos\\AppData\\Roaming\\Signal:/Signal',            │ │
│ │                  │   'carderne/sigexport:v2.3.0',                                            │ │
│ │                  │   '--no-use-docker',                                                      │ │
│ │                  │   '--print-data'                                                          │ │
│ │                  ]                                                                           │ │
│ │           conf = <_io.TextIOWrapper                                                          │ │
│ │                  name='C:\\Users\\Jos\\AppData\\Roaming\\Signal\\config.json' mode='r'       │ │
│ │                  encoding='utf-8'>                                                           │ │
│ │       contacts = {                                                                           │ │
│ │                  │   '7c16ba92-0acd-4710-9498-c58fe5febd12': Contact(                        │ │
│ │                  │   │   id='7c16ba92-0acd-4710-9498-c58fe5febd12',                          │ │
│ │                  │   │   name='xxxxx',                                                  │ │
│ │                  │   │   number='xxxxxxxxxxxx',                                              │ │
│ │                  │   │   profile_name='xxxxxxxxxxx',                                          │ │
│ │                  │   │   is_group=False,                                                     │ │
│ │                  │   │   members=[]                                                          │ │
│ │                  │   ),                                                                      │ │
│ │                  │   '06407f4f-26b2-492e-9fe1-aeb55eb7e0ed': Contact(                        │ │
│ │                  │   │   id='06407f4f-26b2-492e-9fe1-aeb55eb7e0ed',                          │ │
│ │                  │   │   name='xxxxxxxxxxxx',                                              │ │
│ │                  │   │   number='xxxxxxxxxx',                                              │ │
│ │                  │   │   profile_name=None,                                                  │ │
│ │                  │   │   is_group=False,                                                     │ │
│ │                  │   │   members=[]                                                          │ │
│ │                  │   ),                                                                      │ │

....
....
                                                                   │ │
│ │                  }                                                                           │ │
│ │         convos = {                                                                           │ │
│ │                  │   '7c16ba92-0acd-4710-9498-c58fe5febd12': [                               │ │
│ │                  │   │   RawMessage(                                                         │ │
│ │                  │   │   │   conversation_id='7c16ba92-0acd-4710-9498-c58fe5febd12',         │ │
│ │                  │   │   │   id='3944d7bf-529b-4f50-a80b-da867a0361a7',                      │ │
│ │                  │   │   │   body='',                                                        │ │
│ │                  │   │   │   type='message-history-unsynced',                                │ │
│ │                  │   │   │   contact=[],                                                     │ │
│ │                  │   │   │   source=None,                                                    │ │
│ │                  │   │   │   timestamp=1626900258804,                                        │ │
│ │                  │   │   │   sent_at=1626900258804,                                          │ │
│ │                  │   │   │   has_attachments=False,                                          │ │
│ │                  │   │   │   attachments=[],                                                 │ │
│ │                  │   │   │   read_status=None,                                               │ │
│ │                  │   │   │   seen_status=None,                                               │ │
│ │                  │   │   │   call_history=None,                                              │ │
│ │                  │   │   │   reactions=[],                                                   │ │
│ │                  │   │   │   sticker=None,                                                   │ │
│ │                  │   │   │   quote=None                                                      │ │
│ │                  │   │   )                                                                   │ │
│ │                  │   ],                                                                      │ │
...
...

Error in sys.excepthook:
Traceback (most recent call last):
  File "C:\Users\Jos\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\typer\main.py", line 79, in except_hook
    console_stderr.print(rich_tb)
  File "C:\Users\Jos\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\rich\console.py", line 1673, in print
    with self:
  File "C:\Users\Jos\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\rich\console.py", line 865, in __exit__
    self._exit_buffer()
  File "C:\Users\Jos\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\rich\console.py", line 823, in _exit_buffer
    self._check_buffer()
  File "C:\Users\Jos\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\rich\console.py", line 2027, in _check_buffer
    legacy_windows_render(buffer, LegacyWindowsTerm(self.file))
  File "C:\Users\Jos\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\rich\_windows_renderer.py", line 17, in legacy_windows_render
    term.write_styled(text, style)
  File "C:\Users\Jos\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\rich\_win32_console.py", line 442, in write_styled
    self.write_text(text)
  File "C:\Users\Jos\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\rich\_win32_console.py", line 404, in write_text
    self.flush()
KeyboardInterrupt

Original exception was:
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\Jos\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\sigexport\__main__.py", line 4, in <module>
    cli()
  File "C:\Users\Jos\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\sigexport\main.py", line 251, in cli
    run(main)
  File "C:\Users\Jos\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\typer\main.py", line 1067, in run
    app()
  File "C:\Users\Jos\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\typer\main.py", line 326, in __call__
    raise e
  File "C:\Users\Jos\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\typer\main.py", line 309, in __call__
    return get_command(self)(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Jos\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\click\core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Jos\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\typer\core.py", line 661, in main
    return _main(
           ^^^^^^
  File "C:\Users\Jos\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\typer\core.py", line 193, in _main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "C:\Users\Jos\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\click\core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Jos\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\click\core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Jos\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\typer\main.py", line 692, in wrapper
    return callback(**use_params)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Jos\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\sigexport\main.py", line 204, in main
    chat_dict = create.create_chats(convos, contacts)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Jos\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\sigexport\create.py", line 108, in create_chats
    create_message(raw, name, is_group, contacts) for raw in raw_messages
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Jos\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\sigexport\create.py", line 76, in create_message
    quote = msg.quote["text"].rstrip("\n")
            ^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'rstrip'

C:\Users\Jos>
carderne commented 7 months ago

Thanks, fixed in https://github.com/carderne/signal-export/commit/0bde17994e3bbd1b1dcee5f6f4039e5e5f919a87

and released as 2.3.1:

pip install -U signal-export

and you should be good to go