echo_client.py NameError: global name 'dec' is not defined in client/__init__.py in version 0.3

83 views
Skip to first unread message

Qingfeng Xia

unread,
Sep 1, 2013, 5:44:18 PM9/1/13
to ws...@googlegroups.com


python echo_client.py
---------------
Traceback (most recent call last):
  File "echo_client.py", line 28, in <module>
    ws.connect()
  File "/usr/lib/python2.7/dist-packages/ws4py/client/__init__.py", line 206, in connect
    self._write(self.handshake_request)
  File "/usr/lib/python2.7/dist-packages/ws4py/client/__init__.py", line 261, in handshake_request
    headers = self.handshake_headers
  File "/usr/lib/python2.7/dist-packages/ws4py/client/__init__.py", line 246, in handshake_headers
    ('Sec-WebSocket-Key', dec(self.key)),
NameError: global name 'dec' is not defined
------------------

Also, enc(key)  is not defined!,  where is the sec-key encode and decode functions?

Qingfeng Xia

unread,
Sep 2, 2013, 5:23:45 PM9/2/13
to ws...@googlegroups.com

If I just remove dec() and enc()
it will works for first several sending/echo. then for pure digits. it will show  utf8validator error


Exception in thread WebSocketClient:

Traceback (most recent call last):
  File "/QPython/build/python-

install/lib/python2.7/threading.py", line 552, in __bootstrap_inner
  File "/QPython/build/python-install/lib/python2.7/threading.py", line 505, in run
  File "/storage/emulated/0/com.hipipal.qpyplus/lib/site-packages/ws4py/websocket.py", line 427, in run
    if not self.once():
  File "/storage/emulated/0/com.hipipal.qpyplus/lib/site-packages/ws4py/websocket.py", line 305, in once
    if not self.process(b):
  File "/storage/emulated/0/com.hipipal.qpyplus/lib/site-packages/ws4py/websocket.py", line 357, in process
    self.reading_buffer_size = s.parser.send(bytes) or DEFAULT_READING_SIZE
  File "/storage/emulated/0/com.hipipal.qpyplus/lib/site-packages/ws4py/streaming.py", line 218, in receiver
    is_valid, end_on_code_point, _, _ = utf8validator.validate(some_bytes)
  File "/storage/emulated/0/com.hipipal.qpyplus/lib/site-packages/ws4py/utf8validator.py", line 110, in validate
    state = DFA[256 + (state << 4) + DFA[b]]
TypeError: list indices must be integers, not str

Reply all
Reply to author
Forward
0 new messages