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

TypeError: list indices must be integers, not str #16

Closed
majek opened this issue Dec 20, 2011 · 4 comments
Closed

TypeError: list indices must be integers, not str #16

majek opened this issue Dec 20, 2011 · 4 comments

Comments

@majek
Copy link
Contributor

majek commented Dec 20, 2011

I receive this error:

Traceback (most recent call last):
  File "venv/lib/python2.6/site-packages/ws4py/client/threadedclient.py", line 93, in _receive
    next_size = s.parser.send(bytes)
  File "venv/lib/python2.6/site-packages/ws4py/streaming.py", line 181, in receiver
    is_valid, _, _, _ = utf8validator.validate(bytes)
  File "venv/lib/python2.6/site-packages/ws4py/utf8validator.py", line 108, in validate
    self.state = Utf8Validator.UTF8VALIDATOR_DFA[256 + (self.state << 4) + Utf8Validator.UTF8VALIDATOR_DFA[ba[i]]]
TypeError: list indices must be integers, not str
@Lawouach
Copy link
Owner

Hey Majek,

Could your provide more context please?

@majek
Copy link
Contributor Author

majek commented Dec 20, 2011

Sure, but that's not going to be easy :)

  1. install node and recent faye-websocket-node ( by recent I mean: from sources, not npm)

  2. run the code from faye-websocket-node readme. (ie: echo example), like this: https://gist.github.com/b598c88f99b881f296cd

virtualenv venv
./venv/bin/pip install git+https://github.com/Lawouach/WebSocket-for-Python.git

At that point run this code: https://gist.github.com/0418dc998fd7ec5b3d4e

  1. Observe:
$ ./venv/bin/python  a.py 
None
Traceback (most recent call last):
  File "/tmp/venv/lib/python2.6/site-packages/ws4py/client/threadedclient.py", line 93, in _receive
    next_size = s.parser.send(bytes)
  File "/tmp/venv/lib/python2.6/site-packages/ws4py/streaming.py", line 181, in receiver
    is_valid, _, _, _ = utf8validator.validate(bytes)
  File "/tmp/venv/lib/python2.6/site-packages/ws4py/utf8validator.py", line 108, in validate
    self.state = Utf8Validator.UTF8VALIDATOR_DFA[256 + (self.state << 4) + Utf8Validator.UTF8VALIDATOR_DFA[ba[i]]]
TypeError: list indices must be integers, not str

@Lawouach
Copy link
Owner

I see :)

If I may ask you if it's possible that you narrow what bytes were sent to ws4py when it failed? Perhaps catching the exception in ws4py?

@Lawouach
Copy link
Owner

Lawouach commented Jan 3, 2012

This should be fixed with commit 37788d7

Don't hesitate to reopen if you see it coming up again.

@Lawouach Lawouach closed this as completed Jan 3, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants