rdavydov / Twitch-Channel-Points-Miner-v2

A simple script that will watch a stream for you and earn the channel points.
GNU General Public License v3.0
1.21k stars 352 forks source link

fix encoding when reading log file #455

Closed Michael1297 closed 7 months ago

Michael1297 commented 7 months ago

fix character in the log file maybe fixed:

20/02/24 18:02:56 - ERROR - TwitchChannelPointsMiner.classes.AnalyticsServer - [log_exception]: Exception on /log [GET]
Traceback (most recent call last):
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\flask\app.py", line 2529, in wsgi_app
    response = self.full_dispatch_request()
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\flask\app.py", line 1825, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\flask\app.py", line 1823, in full_dispatch_request
    rv = self.dispatch_request()
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\flask\app.py", line 1799, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
  File "C:\Users\Administrator\Documents\Twitch-Channel-Points-Miner-v2-master\TwitchChannelPointsMiner\classes\AnalyticsServer.py", line 256, in generate_log
    log_content = log_file.read()
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\encodings\cp1252.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 43759: character maps to