hfaran / slack-export-viewer

A Slack Export archive viewer that allows you to easily view and share your Slack team's export
https://pypi.python.org/pypi/slack-export-viewer
MIT License
950 stars 193 forks source link

Error with Users/Channels file #102

Closed digital1dragon closed 3 years ago

digital1dragon commented 5 years ago

After pulling a full backup from Slack, I'm faced with the following error.

Nate-mBP:~ nroy$ slack-export-viewer --no-external-references -z ~/Downloads/SlackExports/Test/ Archive already extracted. Viewing from /Users/nroylance/Downloads/SlackExports/Test... Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.7/bin/slack-export-viewer", line 10, in <module> sys.exit(main()) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/click/core.py", line 764, in __call__ return self.main(*args, **kwargs) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/click/core.py", line 717, in main rv = self.invoke(ctx) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/click/core.py", line 956, in invoke return ctx.invoke(self.callback, **ctx.params) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/click/core.py", line 555, in invoke return callback(*args, **kwargs) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/slackviewer/main.py", line 61, in main configure_app(app, archive, channels, no_sidebar, no_external_references, debug) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/slackviewer/main.py", line 29, in configure_app top.mpim_users = reader.compile_mpim_users() File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/slackviewer/reader.py", line 108, in compile_mpim_users mpim_members = {"name": mpim["name"], "users": [self.__USER_DATA[m] for m in mpim["members"]]} File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/slackviewer/reader.py", line 108, in <listcomp> mpim_members = {"name": mpim["name"], "users": [self.__USER_DATA[m] for m in mpim["members"]]} KeyError: 'U9TSE2EQ4'

The work around is adding the KeyError user to the Users file but I'm not sure how many more of these there are. I've gone through 38 of these users so far. Are these users from another workspace?

hfaran commented 5 years ago

@digital1dragon Do you mind using a debugger and adding a breakpoint at this line and check what self.__USER_DATA contains and compare it to the values in mpim["members"]?

I can also debug this myself but I would need to use your dataset because I don't see the same exception with the (relatively old) test dataset that I have. So I would prefer if you took a few minutes to step through this with PyCharm or something.

MiraiHattori commented 5 years ago

I say this casually, but I suppose I've experienced this. I can't remember the details, It might have been bots, deleted users, or inactive users. I'll check it.

Slack sometimes changes it's export format, so telling us the starting date of your export will be helpful.

tjanez commented 3 years ago

I recently encountered the same issue. The PR #139 solves it for me.