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
951 stars 192 forks source link

extracted archives not working #48

Closed depperson closed 6 years ago

depperson commented 6 years ago

I'm trying to use the --archive option to read a directory instead of a zip file but it doesn't work. I've tried a few variations to the path spec like ./slackarchives and /code/slackarchives and /code/slackarchives/ to no avail.

# slack-export-viewer --archive ./slackarchives/
Traceback (most recent call last):
  File "/usr/local/bin/slack-export-viewer", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/slackviewer/main.py", line 60, in main
    configure_app(app, archive, debug)
  File "/usr/local/lib/python3.6/site-packages/slackviewer/main.py", line 34, in configure_app
    path = extract_archive(archive)
  File "/usr/local/lib/python3.6/site-packages/slackviewer/archive.py", line 49, in extract_archive
    raise TypeError("{} is not a zipfile".format(filepath))
TypeError: /slackarchives/ is not a zipfile

This seems to be a problem with https://github.com/hfaran/slack-export-viewer/blob/0.2.0/slackviewer/archive.py#L47. I might eventually get around to fixing this once I need to merge multiple slack exports.

tscritch commented 6 years ago

@hfaran I can take a look as I continue to add some features in the next few weeks 👍

tscritch commented 6 years ago

Hey @depperson

I have determined that the issue is with the usage of os.path. It currently only works with the full file path from the root directory. Try a path like this for now: /Users/<youruser>/Documents/MyExtractedSlackArchive

I'm working on a fix right now. Sorry for the wait!

Mikeldiazot commented 6 years ago

Hi @tscritch I am having the same problem. I tried with the full file path but nothing. Could you help me? It seems to be a great tool/code: MacBook-JJ:~ JJ$ slack-export-viewer -z /users/JJ/documents/slack162018 Traceback (most recent call last): File "/usr/local/bin/slack-export-viewer", line 11, in sys.exit(main()) File "/Library/Python/2.7/site-packages/click/core.py", line 722, in call return self.main(args, kwargs) File "/Library/Python/2.7/site-packages/click/core.py", line 697, in main rv = self.invoke(ctx) File "/Library/Python/2.7/site-packages/click/core.py", line 895, in invoke return ctx.invoke(self.callback, ctx.params) File "/Library/Python/2.7/site-packages/click/core.py", line 535, in invoke return callback(args, **kwargs) File "/Library/Python/2.7/site-packages/slackviewer/main.py", line 50, in main configure_app(app, archive, debug) File "/Library/Python/2.7/site-packages/slackviewer/main.py", line 18, in configure_app path = extract_archive(archive) File "/Library/Python/2.7/site-packages/slackviewer/archive.py", line 49, in extract_archive raise TypeError("{} is not a zipfile".format(filepath)) TypeError: /users/JJ/documents/slack162018 is not a zipfile

tscritch commented 6 years ago

@Mikeldiazot is this /users/JJ/documents/slack162018 a zip file? If so, you need to add the extension to the end for the full file path. It would look like this /users/JJ/documents/slack162018.zip

If it is a directory remove the -z option. Your command would look like this: slack-export-viewer /users/JJ/documents/slack162018