Closed bblising closed 4 years ago
What's the exception that is thrown?
I ran into the same issue. It happens if you are using https://github.com/zach-snell/slack-export , but don't export the public channels. The exception is
File "...slack-export/env_slack-export/lib/python3.6/site-packages/slackviewer/app.py", line 89, in index
return channel_name(channels[0])
IndexError: list index out of range
This is a problem when no public channels are requested in the export. This can be handled by adding other messages types possible from https://github.com/zach-snell/slack-export e.g. private groups, DMS etc.. A suggested start for bug correction is below ..packages/slackviewer/app.py
@app.route("/")
def index():
channels = list(flask._app_ctx_stack.channels.keys())
groups = list(flask._app_ctx_stack.groups.keys())
dm_users = list(flask._app_ctx_stack.dm_users)
mpim_users = list(flask._app_ctx_stack.mpim_users)
if(len(channels) > 0):
if "general" in channels:
return channel_name("general")
else:
return channel_name(channels[0])
elif(len(groups) >0):
return(group_name(groups[0]))
elif(len(dm_users) >0):
return(dm_id(dm_users[0]))
else:
print("Not sure where to start- Try adding a Private group, Public group or DM to the slack-export ")
Release 1.0.1 published
We are on on a free subscription and we've long forgotten whether we used the default Random and General channels. They are empty after using https://github.com/zach-snell/slack-export and this causes an exception to the lines
in app.py. The workaround I did is to wrap this in an exception and return the first DM instead.