Skip to content
This repository has been archived by the owner on Jul 21, 2020. It is now read-only.

Example hit several Exceptions when whispering bot account #8

Open
Tothinator opened this issue Jun 27, 2017 · 4 comments
Open

Example hit several Exceptions when whispering bot account #8

Tothinator opened this issue Jun 27, 2017 · 4 comments

Comments

@Tothinator
Copy link

ERROR:tornado.application:Uncaught exception, closing connection.
Traceback (most recent call last):
  File "C:\Users\dtoth\Anaconda3\lib\site-packages\tornado\websocket.py", line 412, in _run_callback
    callback(*args, **kwargs)
  File "C:\Users\dtoth\Anaconda3\lib\site-packages\tornado\websocket.py", line 995, in on_message
    self._on_message_callback(message)
  File "C:\Users\dtoth\Dropbox\beambot\python\beam-client-python\chatty\socket.py", line 45, in parse_packet
    self.emit("message", packet)
  File "C:\Users\dtoth\Dropbox\beambot\python\beam-client-python\chatty\evented.py", line 15, in emit
    handler[1](*args)
  File "C:\Users\dtoth\Dropbox\beambot\python\beam-client-python\chatty\connection.py", line 55, in <lambda>
    self.websocket.on("message", lambda msg: self.emit("message", msg))
  File "C:\Users\dtoth\Dropbox\beambot\python\beam-client-python\chatty\evented.py", line 15, in emit
    handler[1](*args)
  File "example.py", line 11, in _handle_chat
    chatevents.formatting(data)
  File "C:\Users\dtoth\Dropbox\beambot\python\beam-client-python\ChatEventHandler.py", line 21, in formatting
    func(data)
  File "C:\Users\dtoth\Dropbox\beambot\python\beam-client-python\ChatEventHandler.py", line 78, in type_event
    msg=msg))
  File "C:\Users\dtoth\Anaconda3\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 '\u2192' in position 11: character maps to <undefined>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\dtoth\Anaconda3\lib\site-packages\tornado\iostream.py", line 554, in wrapper
    return callback(*args)
  File "C:\Users\dtoth\Anaconda3\lib\site-packages\tornado\stack_context.py", line 343, in wrapped
    raise_exc_info(exc)
  File "<string>", line 3, in raise_exc_info
  File "C:\Users\dtoth\Anaconda3\lib\site-packages\tornado\stack_context.py", line 314, in wrapped
    ret = fn(*args, **kwargs)
  File "C:\Users\dtoth\Anaconda3\lib\site-packages\tornado\websocket.py", line 804, in _on_frame_data
    self._handle_message(opcode, data)
  File "C:\Users\dtoth\Anaconda3\lib\site-packages\tornado\websocket.py", line 824, in _handle_message
    self._run_callback(self.handler.on_message, decoded)
  File "C:\Users\dtoth\Anaconda3\lib\site-packages\tornado\websocket.py", line 415, in _run_callback
    self.request.path, exc_info=True)
  File "C:\Users\dtoth\Anaconda3\lib\site-packages\tornado\httpclient.py", line 634, in __getattr__
    request_attr = getattr(self.request, name)
AttributeError: 'HTTPRequest' object has no attribute 'path'
ERROR:tornado.application:Exception in callback functools.partial(<function wrap.<locals>.null_wrapper at 0x000001ECFD2A9E18>)
Traceback (most recent call last):
  File "C:\Users\dtoth\Anaconda3\lib\site-packages\tornado\websocket.py", line 412, in _run_callback
    callback(*args, **kwargs)
  File "C:\Users\dtoth\Anaconda3\lib\site-packages\tornado\websocket.py", line 995, in on_message
    self._on_message_callback(message)
  File "C:\Users\dtoth\Dropbox\beambot\python\beam-client-python\chatty\socket.py", line 45, in parse_packet
    self.emit("message", packet)
  File "C:\Users\dtoth\Dropbox\beambot\python\beam-client-python\chatty\evented.py", line 15, in emit
    handler[1](*args)
  File "C:\Users\dtoth\Dropbox\beambot\python\beam-client-python\chatty\connection.py", line 55, in <lambda>
    self.websocket.on("message", lambda msg: self.emit("message", msg))
  File "C:\Users\dtoth\Dropbox\beambot\python\beam-client-python\chatty\evented.py", line 15, in emit
    handler[1](*args)
  File "example.py", line 11, in _handle_chat
    chatevents.formatting(data)
  File "C:\Users\dtoth\Dropbox\beambot\python\beam-client-python\ChatEventHandler.py", line 21, in formatting
    func(data)
  File "C:\Users\dtoth\Dropbox\beambot\python\beam-client-python\ChatEventHandler.py", line 78, in type_event
    msg=msg))
  File "C:\Users\dtoth\Anaconda3\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 '\u2192' in position 11: character maps to <undefined>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\dtoth\Anaconda3\lib\site-packages\tornado\ioloop.py", line 604, in _run_callback
    ret = callback()
  File "C:\Users\dtoth\Anaconda3\lib\site-packages\tornado\stack_context.py", line 275, in null_wrapper
    return fn(*args, **kwargs)
  File "C:\Users\dtoth\Anaconda3\lib\site-packages\tornado\iostream.py", line 554, in wrapper
    return callback(*args)
  File "C:\Users\dtoth\Anaconda3\lib\site-packages\tornado\stack_context.py", line 343, in wrapped
    raise_exc_info(exc)
  File "<string>", line 3, in raise_exc_info
  File "C:\Users\dtoth\Anaconda3\lib\site-packages\tornado\stack_context.py", line 314, in wrapped
    ret = fn(*args, **kwargs)
  File "C:\Users\dtoth\Anaconda3\lib\site-packages\tornado\websocket.py", line 804, in _on_frame_data
    self._handle_message(opcode, data)
  File "C:\Users\dtoth\Anaconda3\lib\site-packages\tornado\websocket.py", line 824, in _handle_message
    self._run_callback(self.handler.on_message, decoded)
  File "C:\Users\dtoth\Anaconda3\lib\site-packages\tornado\websocket.py", line 415, in _run_callback
    self.request.path, exc_info=True)
  File "C:\Users\dtoth\Anaconda3\lib\site-packages\tornado\httpclient.py", line 634, in __getattr__
    request_attr = getattr(self.request, name)
AttributeError: 'HTTPRequest' object has no attribute 'path'
@SimonSchick
Copy link

Can you please provide some context?

@Tothinator
Copy link
Author

The example disconnects with these exceptions then reconnects whenever you "/whisper @botaccount test"

So when my bot joins the channel and I whisper it, it will time out for a second. It also does not pick up chat whispers sent between other accounts, though I do not know if Mixer sends that information.

@Purzifal
Copy link
Contributor

Purzifal commented Jul 6, 2017

i know this issue, its raised because of this error

UnicodeEncodeError: 'charmap' codec can't encode character '\u2192' in position 11: character maps to

this is solved in Command Prompt and Powershell on windows by changing the charmap by running the command

chcp 65001

however @Tothinator uses gitbash which i am unfamiliar with. its not an issue with the coding but gitbash cannot display the character.

to replicate it, run the chatbot in windows using cmd or powershell without changing the charmap (chcp 65001), this is a console issue

In the windows command prompt the console's code page can be changed to Unicode (cp65001) before starting Python using chcp (if using GitBash type chcp.com instead):

@Purzifal
Copy link
Contributor

@SimonSchick this issue can really be closed as this issue is related to a limitation with Command Prompt and not a coding issue

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

3 participants