Closed pkaldis closed 2 years ago
Same issue here running python 2.7 and 3.6
Schema might have changed in the export - can you put a breakpoint there to see what keys are in the dictionary to figure out what it might have changed to?
/tmp/_slackviewer/26b10a07947e773d8f07e2e3503d54a317f0256f already exists
Traceback (most recent call last):
File "/home/username/.local/bin/slack-export-viewer", line 11, in <module>
sys.exit(main())
File "/home/username/.local/lib/python3.6/site-packages/click/core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "/home/username/.local/lib/python3.6/site-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/home/username/.local/lib/python3.6/site-packages/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/username/.local/lib/python3.6/site-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/home/username/.local/lib/python3.6/site-packages/slackviewer/main.py", line 61, in main
configure_app(app, archive, channels, no_sidebar, no_external_references, debug)
File "/home/username/.local/lib/python3.6/site-packages/slackviewer/main.py", line 24, in configure_app
top.channels = reader.compile_channels(channels)
File "/home/username/.local/lib/python3.6/site-packages/slackviewer/reader.py", line 35, in compile_channels
return self._create_messages(channel_names, channel_data)
File "/home/username/.local/lib/python3.6/site-packages/slackviewer/reader.py", line 176, in _create_messages
chats = self._build_threads(chats)
File "/home/username/.local/lib/python3.6/site-packages/slackviewer/reader.py", line 199, in _build_threads
for reply in message._message['replies']:
KeyError: 'replies'
I changed line 199 to:
for reply in message._message.get('replies', []):
just as a quick patch.
the thread replies are no longer embedded in the messages themselves.
they are now separate messages/blocks that are correlated via the thread_ts
values, as also explained here: https://api.slack.com/messaging/retrieving#finding_threads
While looking at this, I noticed what I think might another bug/potential bug: https://github.com/hfaran/slack-export-viewer/blob/af67f79f0968b4f8981ab96468b62a816be82b87/slackviewer/reader.py#L203 followed by https://github.com/hfaran/slack-export-viewer/blob/af67f79f0968b4f8981ab96468b62a816be82b87/slackviewer/reader.py#L210
The for loop goes through an list and inside the body of the loop elements are removed from the list. wouldn't this cause messages to be skipped?
Running the viewer against our data export takes a bit of time, but eventually it exits with the following error:
pkaldis@anatomy ~/Desktop/Export --> slack-export-viewer -z data_export.zip /var/folders/gt/f1j5l07n1zd6_3r_7rz6jgzc0001g1/T/_slackviewer/90d4e276bb39a4adce4ff381bf0ce8bef12e7bf6 already exists Traceback (most recent call last): File "/usr/local/bin/slack-export-viewer", line 11, in
sys.exit(main())
File "/usr/local/lib/python2.7/site-packages/click/core.py", line 764, in call
return self.main(args, kwargs)
File "/usr/local/lib/python2.7/site-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python2.7/site-packages/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, ctx.params)
File "/usr/local/lib/python2.7/site-packages/click/core.py", line 555, in invoke
return callback(args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/slackviewer/main.py", line 61, in main
configure_app(app, archive, channels, no_sidebar, no_external_references, debug)
File "/usr/local/lib/python2.7/site-packages/slackviewer/main.py", line 24, in configure_app
top.channels = reader.compile_channels(channels)
File "/usr/local/lib/python2.7/site-packages/slackviewer/reader.py", line 35, in compile_channels
return self._create_messages(channel_names, channel_data)
File "/usr/local/lib/python2.7/site-packages/slackviewer/reader.py", line 176, in _create_messages
chats = self._build_threads(chats)
File "/usr/local/lib/python2.7/site-packages/slackviewer/reader.py", line 199, in _build_threads
for reply in message._message['replies']:
KeyError: 'replies'
Any insights on how to troubleshooting this would be greatly appreciated.
Thank you!