You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 12, 2019. It is now read-only.
jd001@uservm001:/home/jd001# backup_slack --token='here_is_token'
Saving username list to ./users.json
Saving public channels to ./channels
Saving private channels to ./private_channels
Saving direct messages to ./direct_messages
Traceback (most recent call last):
File "/usr/local/bin/backup_slack", line 9, in
load_entry_point('backup-slack==1.0.0', 'console_scripts', 'backup_slack')()
File "/home/jd001/slack/py/src/backup-slack/backup_slack.py", line 252, in main
download_dm_threads(slack, outdir=direct_messages)
File "/home/jd001/slack/py/src/backup-slack/backup_slack.py", line 102, in download_dm_threads
for thread in slack.dm_threads():
File "/home/jd001/slack/py/src/backup-slack/backup_slack.py", line 197, in dm_threads
t['username'] = self.usernames[t['user']]
KeyError: u'F1J6QHSP4'
jd001@uservm001:/home/jd001#
The text was updated successfully, but these errors were encountered:
A quick hack to get around this is to change this to a get-with-default style of call in backup_slack.py:197: t['username'] = self.usernames.get(t['user'],'???')
This fixes the problem where a username was not collected, for whatever reason. The "???" can be any value, and there will be a "???.json" user added under "direct_messages".
need the below check in "dm_threads(self)" method to make sure user exists in 'self.usernames', otherwise code aborts in the assigment stmt below with a "key error", e.g. when "t" has 'is_user_deleted' as "true" or when t['user'] has spaces in it, each of which results in "key error"s:
if t['user'] in self.usernames:
t['username'] = self.usernames[t['user']]
threads.append(t)
and believe it best if we implement the change in this original repo as well, for benefit of users of this repo and it's forks
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
jd001@uservm001:/home/jd001# backup_slack --token='here_is_token'
Saving username list to ./users.json
Saving public channels to ./channels
Saving private channels to ./private_channels
Saving direct messages to ./direct_messages
Traceback (most recent call last):
File "/usr/local/bin/backup_slack", line 9, in
load_entry_point('backup-slack==1.0.0', 'console_scripts', 'backup_slack')()
File "/home/jd001/slack/py/src/backup-slack/backup_slack.py", line 252, in main
download_dm_threads(slack, outdir=direct_messages)
File "/home/jd001/slack/py/src/backup-slack/backup_slack.py", line 102, in download_dm_threads
for thread in slack.dm_threads():
File "/home/jd001/slack/py/src/backup-slack/backup_slack.py", line 197, in dm_threads
t['username'] = self.usernames[t['user']]
KeyError: u'F1J6QHSP4'
jd001@uservm001:/home/jd001#
The text was updated successfully, but these errors were encountered: