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
901 stars 189 forks source link

UnicodeEncodeError: 'charmap' codec can't encode character '\u202f' in position 54: character maps to <undefined> encoding with 'cp437' codec failed #184

Open codejoey opened 4 months ago

codejoey commented 4 months ago

Tried to view an export zip via Mac terminal.

Ran into this error which halts it. Any ideas?

Traceback (most recent call last): File "/Users/Joey/.local/bin/slack-export-viewer", line 10, in sys.exit(main()) ^^^^^^ File "/Users/Joey/Library/Application Support/pipx/venvs/slack-export-viewer/lib/python3.12/site-packages/click/core.py", line 1157, in call return self.main(args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/Joey/Library/Application Support/pipx/venvs/slack-export-viewer/lib/python3.12/site-packages/click/core.py", line 1078, in main rv = self.invoke(ctx) ^^^^^^^^^^^^^^^^ File "/Users/Joey/Library/Application Support/pipx/venvs/slack-export-viewer/lib/python3.12/site-packages/click/core.py", line 1434, in invoke return ctx.invoke(self.callback, ctx.params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/Joey/Library/Application Support/pipx/venvs/slack-export-viewer/lib/python3.12/site-packages/click/core.py", line 783, in invoke return __callback(args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/Joey/Library/Application Support/pipx/venvs/slack-export-viewer/lib/python3.12/site-packages/slackviewer/main.py", line 79, in main configure_app(app, archive, channels, no_sidebar, no_external_references, debug) File "/Users/Joey/Library/Application Support/pipx/venvs/slack-export-viewer/lib/python3.12/site-packages/slackviewer/main.py", line 21, in configure_app path = extract_archive(archive) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/Joey/Library/Application Support/pipx/venvs/slack-export-viewer/lib/python3.12/site-packages/slackviewer/archive.py", line 74, in extract_archive info.filename = info.filename.encode("cp437").decode("utf-8") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/Cellar/python@3.12/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/encodings/cp437.py", line 12, in encode return codecs.charmap_encode(input,errors,encoding_map) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UnicodeEncodeError: 'charmap' codec can't encode character '\u202f' in position 54: character maps to encoding with 'cp437' codec failed

gunchev commented 3 months ago

I managed to get something working by first extracting the archive in a new directory and then point the viewer to that. I know, workaround, but haven't debugged it. It was trying to decore an utf-8 string using cp437.