Skip to content

client doesn't recover after invalid argument in Redis.set() #24

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

Closed
marw opened this issue Mar 31, 2010 · 4 comments
Closed

client doesn't recover after invalid argument in Redis.set() #24

marw opened this issue Mar 31, 2010 · 4 comments

Comments

@marw
Copy link

marw commented Mar 31, 2010

Following code does not work:

import redis.client
db = redis.client.Redis('localhost', 6379)
db.set("example","123")
True
try:
... db.set("invalid key","123")
... except Exception, e:
... print str(e)
...
wrong number of arguments for 'set' command
db.set("example","123")
Traceback (most recent call last):
...
File "<...>\redis\client.py", line 274, in _parse_response
raise ResponseError(response)
redis.exceptions.ResponseError: unknown command '123'

The same behavior is with Redis server 1.2.2 and 1.3.7

@kmerenkov
Copy link
Contributor

It restores its behaviour after you try set for one more time.
This problem is related to usage of inline protocol that should be ditched in favor of multi-bulk protocol.
As for now redis-py isn't binary-safe (i.e. you can't use spaces in keys).

@andymccurdy
Copy link
Contributor

And now, thanks for kmerenkov, redis-py is binary safe. Upgrade to b33a6fc and issue is resolved.

@marw
Copy link
Author

marw commented Apr 1, 2010

But now, this code doesn't raise error:
db.set("invalid key","123")

@andymccurdy
Copy link
Contributor

That's because it isn't an error. Any character including spaces are valid in key names.

This issue was closed.
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

3 participants