-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Exception raised when publishing from a pubsub object #151
Comments
It was an error to add the I've already removed Thanks for the bug report! |
According to the Redis docs on
The above commands are allowed by Redis but the Python client doesn't allow any command at all after |
when I listened,after a while,I can‘t get message any more
|
@eyison This seems like a completely different issue. I suspect the TCP connection between the client and server was interrupted. I would suggest using one of the keepalive settings. |
pip freeze | grep redis
redis==2.4.5
This code works correctly:
import redis
r = redis.Redis(password='yomama')
r.publish('foo','bar')
This code fails, although the message is correctly published before the code raises an exception:
import redis
r = redis.Redis(password='yomama')
ps = r.pubsub()
ps.publish('foo','bar')
Traceback (most recent call last):
File "./test2", line 6, in
ps.publish('foo','bar')
File "/Users/nfarring/.virtualenvs/mordia/lib/python2.7/site-packages/redis/client.py", line 1136, in publish
return self.execute_command('PUBLISH', channel, message)
File "/Users/nfarring/.virtualenvs/mordia/lib/python2.7/site-packages/redis/client.py", line 1063, in execute_command
return self.parse_response()
File "/Users/nfarring/.virtualenvs/mordia/lib/python2.7/site-packages/redis/client.py", line 1078, in parse_response
if response[0] in self.subscribe_commands:
TypeError: 'long' object is not subscriptable
Here is the same output using ipython:
TypeError Traceback (most recent call last)
/Users/nfarring/ in ()
/Users/nfarring/.virtualenvs/mordia/lib/python2.7/site-packages/redis/client.pyc in publish(self, channel, message)
1134 Returns the number of subscribers the message was delivered to.
1135 """
-> 1136 return self.execute_command('PUBLISH', channel, message)
1137
1138 def listen(self):
/Users/nfarring/.virtualenvs/mordia/lib/python2.7/site-packages/redis/client.pyc in execute_command(self, _args, *_kwargs)
1061 try:
1062 connection.send_command(*args)
-> 1063 return self.parse_response()
1064 except ConnectionError:
1065 connection.disconnect()
/Users/nfarring/.virtualenvs/mordia/lib/python2.7/site-packages/redis/client.pyc in parse_response(self)
1076 "Parse the response from a publish/subscribe command"
1077 response = self.connection.read_response()
-> 1078 if response[0] in self.subscribe_commands:
1079 self.subscription_count = response[2]
1080 # if we've just unsubscribed from the remaining channels,
TypeError: 'long' object is not subscriptable
The text was updated successfully, but these errors were encountered: