setex fails with "value is not an integer or out of range"
See original GitHub issueHi,
I am trying to use setex method, however it fails with following error:
“value is not an integer or out of range”
I am using it as below:
r.setex(sid, ttl.seconds, jsn) where ttl is a timedelta object
Here is the trace:
▶ Local vars /Library/Python/2.7/site-packages/redis/client.py in setex
return self.execute_command('SETEX', name, time, value)
...
▶ Local vars /Library/Python/2.7/site-packages/redis/client.py in execute_command
return self.parse_response(connection, command_name, **options)
...
▶ Local vars /Library/Python/2.7/site-packages/redis/client.py in parse_response
response = connection.read_response()
...
▶ Local vars /Library/Python/2.7/site-packages/redis/connection.py in read_response
raise response
...
▼ Local vars Variable Value self
<redis.connection.Connection object at 0x10f7050d0>
response
ResponseError(‘value is not an integer or out of range’,)
However the same thing succeeds via it’s non-atomic version:
r.set(sid, jsn) r.expire(sid, ttl.seconds)
what am i doing wrong (if any), or probably there is some bug to be fixed.
Issue Analytics
- State:
- Created 11 years ago
- Comments:11 (3 by maintainers)

Top Related StackOverflow Question
If someone is still facing this issue, consider switching from:
to
because according to Redis docs it should be:
redis> SETEX mykey 10 "Hello"Explicit is always better than not.