Giter Site home page Giter Site logo

UnicodeDecodeError about slack-export-viewer HOT 9 CLOSED

hfaran avatar hfaran commented on June 29, 2024
UnicodeDecodeError

from slack-export-viewer.

Comments (9)

bartschuller avatar bartschuller commented on June 29, 2024 2

I got the same error on Windows using Python36, but not on Mac using Python 2.7. The reference in the stack trace to "cp1252.py" is suspicious because we don't want any platform-specific things happening to the nice UTF-8 files.

In my case there were no channels with strange characters in their names, but messages do have them.

from slack-export-viewer.

jonathangjertsen avatar jonathangjertsen commented on June 29, 2024 1

With Python 3.6, I got rid of this error (probably caused by the characters æøå used by my Norwegian Slack team) by adding encoding="utf-8" to the relevant calls to open() in archive.py. I think this breaks compatibility with Python 2, but I haven't tested that. jonathangjertsen@fea797e

from slack-export-viewer.

vetash avatar vetash commented on June 29, 2024

@BenneyP i have similar problem, and got workaround:
Slack recently added Your channels, your language feature that allow you to add channel in any languange. So if you have not latin characters in your room name you should exclude that channels from zip file (simply remove from them archive) and remove section with these channels from channels.json file.

from slack-export-viewer.

steventango avatar steventango commented on June 29, 2024

Same issue on Windows 10 64bit Python36-64
Here is the only difference in the log:
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 10274: character maps to <undefined>
Seems like "<undefined>" was messed up by markdown.

from slack-export-viewer.

hfaran avatar hfaran commented on June 29, 2024

Does anyone have a sample json file they'd like to volunteer? Seems like we just need to use the correct encoding when json.loadsing the file (if indeed everyone here is having the same issue).
Should ideally be a relatively simple fix assuming that is the issue.

from slack-export-viewer.

SpitUnicsoft avatar SpitUnicsoft commented on June 29, 2024

Hi @hfaran!
Thank you for your great job!
Please take a look at the file attached (hf.zip). It produces next error on Windows 10 x64:
C:\XX>slack-export-viewer -z hf.zip
/tmp_slackviewer\1e1584694b283d5f2c098dec43343d00426c2536 already exists
Traceback (most recent call last):
File "c:\program files (x86)\python36-32\lib\runpy.py", line 193, in run_module_as_main
"main", mod_spec)
File "c:\program files (x86)\python36-32\lib\runpy.py", line 85, in run_code
exec(code, run_globals)
File "C:\Program Files (x86)\Python36-32\Scripts\slack-export-viewer.EXE_main.py", line 9, in
File "c:\program files (x86)\python36-32\lib\site-packages\click\core.py", line 722, in call
return self.main(*args, **kwargs)
File "c:\program files (x86)\python36-32\lib\site-packages\click\core.py", line 697, in main
rv = self.invoke(ctx)
File "c:\program files (x86)\python36-32\lib\site-packages\click\core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "c:\program files (x86)\python36-32\lib\site-packages\click\core.py", line 535, in invoke
return callback(*args, **kwargs)
File "c:\program files (x86)\python36-32\lib\site-packages\slackviewer\main.py", line 60, in main
configure_app(app, archive, debug)
File "c:\program files (x86)\python36-32\lib\site-packages\slackviewer\main.py", line 37, in configure_app
channels = compile_channels(path, user_data, channel_data)
File "c:\program files (x86)\python36-32\lib\site-packages\slackviewer\archive.py", line 24, in compile_channels
day_messages = json.load(f)
File "c:\program files (x86)\python36-32\lib\json_init.py", line 296, in load
return loads(fp.read(),
File "c:\program files (x86)\python36-32\lib\encodings\cp1251.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x98 in position 129: character maps to
hf.zip

I appreciate you fixing the bug.
hf.zip

from slack-export-viewer.

MikeFoden avatar MikeFoden commented on June 29, 2024

@bartschuller Did you try this with Python 2.7 on Windows?

from slack-export-viewer.

bartschuller avatar bartschuller commented on June 29, 2024

@MikeFoden Sorry, I didn't and it's not easy for me to try.

from slack-export-viewer.

hfaran avatar hfaran commented on June 29, 2024

Only took me about a year, but finally got around to running it on my Windows box and fixing the issues. Encoding issue should be fixed!

from slack-export-viewer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.