question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

setex fails with "value is not an integer or out of range"

See original GitHub issue

Hi,

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:closed
  • Created 11 years ago
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

29reactions
despritcommented, Mar 14, 2017

If someone is still facing this issue, consider switching from:

r.setex('x', 'y', 1)

to

r.setex('x', 1, 'y')

because according to Redis docs it should be: redis> SETEX mykey 10 "Hello"

18reactions
shyalcommented, Dec 12, 2017

Explicit is always better than not.

self._cache.setex(name=key, time=10, value=value)
Read more comments on GitHub >

github_iconTop Results From Across the Web

Redis - setex - value is not an integer or out of range
The issue is between the different redis clients. When working with StrictRedis , the setex syntax is: setex key, expiry, value.
Read more >
setex fails with "value is not an integer or out of range" #260
Hi,. I am trying to use setex method, however it fails with following error: "value is not an integer or out of range"....
Read more >
redis.exceptions.ResponseError: value is not an integer or out ...
I got error when I click the 'item code' field in the table below. how can I ... ResponseError: value is not an...
Read more >
Redis调用setex()时报错redis.exceptions.ResponseError
redis报错: redis.exceptions.ResponseError: value is not an integer or out of range · redis-py Documentation · redis-py GitHub · Redis Setex 命令| ...
Read more >
redis.exceptions.ResponseError: value is not an integer or out ...
问题描述今天在使用python的redis客户端时碰到了这样的报错:redis.exceptions.ResponseError: value is not an integer or out of.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found