ThioJoe / YT-Spammer-Purge

Allows you easily scan for and delete scam comments using several methods.
GNU General Public License v3.0
4.57k stars 389 forks source link

[Bug]: Crash while displaying comments #949

Closed GermanCoding closed 1 year ago

GermanCoding commented 1 year ago

Duplicate Issues

What happened?

Scanned the last 10 videos of this channel https://www.youtube.com/c/jetlagthegame using Auto-Smart Mode. While displaying comments, the program crashed:

14. Traceback (most recent call last):
  File "D:\Users\Joe\Documents\GitHub ThioJoe\YouTube-Spammer-Purge\YTSpammerPurge.py", line 1705, in <module>
  File "D:\Users\Joe\Documents\GitHub ThioJoe\YouTube-Spammer-Purge\YTSpammerPurge.py", line 1682, in main
  File "D:\Users\Joe\Documents\GitHub ThioJoe\YouTube-Spammer-Purge\YTSpammerPurge.py", line 1317, in primaryInstance
  File "Scripts\logging.py", line 28, in print_comments
    j, commentsContents = print_prepared_comments(current, commentsContents, scanVideoID, list(current.matchedCommentsDict.keys()), j, loggingEnabled, scanMode, logMode, doWritePrint, matchReason="Filter Match")
  File "Scripts\logging.py", line 319, in print_prepared_comments
    print(str(j+1) + f". {F.LIGHTCYAN_EX}" + author + f"{S.R}:  {F.YELLOW}" + text + f"{S.R}")
  File "colorama\ansitowin32.py", line 41, in write
  File "colorama\ansitowin32.py", line 162, in write
  File "colorama\ansitowin32.py", line 187, in write_and_convert
  File "colorama\ansitowin32.py", line 195, in write_plain_text
  File "encodings\cp1252.py", line 19, in encode
UnicodeEncodeError: 'charmap' codec can't encode character '\u2b55' in position 1: character maps to <undefined>
------------------------------------------------
Error Message: 'charmap' codec can't encode character '\u2b55' in position 1: character maps to <undefined>

Unknown Error - Code: Z-3 occurred. If this keeps happening, consider posting a bug report
on the GitHub issues page, and include the above error info.
Short Link: TJoe.io/bug-report

(Crash is perhabps due to a comment with weird encoding?)

Release version

v2.17.0-Beta3

Steps to reproduce

  1. Scan the last 10 videos of this channel https://www.youtube.com/c/jetlagthegame
  2. Select Auto-Smart Mode
  3. Wait until comments are displayed

What platform are you seeing this problem on?

Windows (.exe file)

Relevant log output

14. Traceback (most recent call last):
  File "D:\Users\Joe\Documents\GitHub ThioJoe\YouTube-Spammer-Purge\YTSpammerPurge.py", line 1705, in <module>
  File "D:\Users\Joe\Documents\GitHub ThioJoe\YouTube-Spammer-Purge\YTSpammerPurge.py", line 1682, in main
  File "D:\Users\Joe\Documents\GitHub ThioJoe\YouTube-Spammer-Purge\YTSpammerPurge.py", line 1317, in primaryInstance
  File "Scripts\logging.py", line 28, in print_comments
    j, commentsContents = print_prepared_comments(current, commentsContents, scanVideoID, list(current.matchedCommentsDict.keys()), j, loggingEnabled, scanMode, logMode, doWritePrint, matchReason="Filter Match")
  File "Scripts\logging.py", line 319, in print_prepared_comments
    print(str(j+1) + f". {F.LIGHTCYAN_EX}" + author + f"{S.R}:  {F.YELLOW}" + text + f"{S.R}")
  File "colorama\ansitowin32.py", line 41, in write
  File "colorama\ansitowin32.py", line 162, in write
  File "colorama\ansitowin32.py", line 187, in write_and_convert
  File "colorama\ansitowin32.py", line 195, in write_plain_text
  File "encodings\cp1252.py", line 19, in encode
UnicodeEncodeError: 'charmap' codec can't encode character '\u2b55' in position 1: character maps to <undefined>
------------------------------------------------
Error Message: 'charmap' codec can't encode character '\u2b55' in position 1: character maps to <undefined>

Unknown Error - Code: Z-3 occurred. If this keeps happening, consider posting a bug report
on the GitHub issues page, and include the above error info.
Short Link: TJoe.io/bug-report


### Screenshots

_No response_
ThioJoe commented 1 year ago

Hm apparently it couldn't handle this character: ⭕

I'll have to see why

GermanCoding commented 1 year ago

Oh I just recalled that I may have run this from a MSYS2 terminal (don't recall exactly, could have been a standard terminal too). Does that perhaps influence the ability of rendering certain unicode? I do recall seeing some non-ASCII chars on the terminal.

I can try with a more conventional terminal tomorrow.

Firecul commented 1 year ago

Oh I just recalled that I may have run this from a MSYS2 terminal (don't recall exactly, could have been a standard terminal too). Does that perhaps influence the ability of rendering certain unicode? I do recall seeing some non-ASCII chars on the terminal.

It might, it's working fine on Windows Terminal using the latest .py version on the beta branch for me.

image

ThioJoe commented 1 year ago

Looks like this is the offending comment, which is # 11 in Firecul's screenshot above: https://www.youtube.com/watch?v=LBxeKFuGxJA&lc=Ugzn5XgQy5jc_XncDg94AaABAg

I do believe it must be your terminal program. I tried running it in both Windows 11 and Windows 10 (since Windows 10 console host uses the older character set, so it renders that character as a question mark), and neither crashed.

image

So I'll just close this