Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Log Error for event logging (UnicodeEncodeError) #904

Closed
1 task done
Donbur4156 opened this issue Jul 5, 2022 · 2 comments · Fixed by #926
Closed
1 task done

[BUG] Log Error for event logging (UnicodeEncodeError) #904

Donbur4156 opened this issue Jul 5, 2022 · 2 comments · Fixed by #926
Assignees
Labels
bug Something isn't working

Comments

@Donbur4156
Copy link
Contributor

Describe the bug.

When starting the Bot in logging.DEBUG mode, some (especially GUILDE_CREATE) Events raise a Log Error.
UnicodeEncodeError: 'charmap' codec can't encode character

List the steps.

  1. start the bot
  2. logging error in terminal

What you expected.

The Event should be logged in the logging file.

What you saw.

Instead, I received this traceback error given from my Python terminal:

Traceback (most recent call last):
  File "C:\...\Python38\lib\logging\__init__.py", line 1088, in emit
    stream.write(msg + self.terminator)
  File "C:\...\Python38\lib\encodings\cp1252.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\u2b50' in position 54566: character maps to <undefined>

[.......]

File "c:\...\.venv\lib\site-packages\interactions\api\gateway\client.py", line 256, in _handle_connection
    log.debug(f"{event}: {str(data)}")

What version of the library did you use?

stable

Version specification

No response

Code of Conduct

  • I agree to follow the contribution requirements.
@Donbur4156 Donbur4156 added the bug Something isn't working label Jul 5, 2022
@Donbur4156
Copy link
Contributor Author

Donbur4156 commented Jul 5, 2022

The following fix is working for me:

interactions>api>gateway>client.py line 256
WebsocketClient --> _handle_connection
log.debug(f"{event}: {str(data).encode('utf-8')}")

@Toricane Toricane linked a pull request Jul 15, 2022 that will close this issue
7 tasks
@Toricane
Copy link
Contributor

Closing since the PR linked above resolved this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants