Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7413945
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T06:58:46+00:00 2026-05-29T06:58:46+00:00

I am trying to delete all keys except some in Redis, and I do

  • 0

I am trying to delete all keys except some in Redis, and I do get the following exception:

  ... File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/twisted/protocols/basic.py", line 572, in dataReceived
    return self.rawDataReceived(data)
  File "build/bdist.macosx-10.6-intel/egg/txredisapi/protocol.py", line 184, in rawDataReceived

  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/twisted/protocols/basic.py", line 589, in setLineMode
    return self.dataReceived(extra)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/twisted/protocols/basic.py", line 564, in dataReceived
    why = self.lineReceived(line)
  File "build/bdist.macosx-10.6-intel/egg/txredisapi/protocol.py", line 134, in lineReceived

exceptions.RuntimeError: maximum recursion depth exceeded

Here is the code:

@defer.inlineCallbacks
def resetAll(self):
    dict=yield self.factory.conn.keys()        
    for xyz in dict:
        if xyz<>"game" and xyz<>"people" and xyz<>"said":
            val = yield self.factory.conn.delete(xyz)

# ...

if __name__ == '__main__':
    from twisted.internet import reactor 
    conn = txredisapi.lazyRedisConnectionPool(reconnect = True)
    factory = STSFactory(conn)
    factory.clients = []

    print "Server started"
    reactor.listenTCP(11000,factory)
    reactor.listenTCP(11001,factory)
    reactor.listenTCP(11002,factory)
    reactor.run()

When I call resetAll function with around 725 keys in Redis, I got the exception fired. With lower numbers like 200 etc it is not fired. Anybody has an idea what is happening? Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T06:58:47+00:00Added an answer on May 29, 2026 at 6:58 am

    Try this on a terminal of a Linux/Mac computer with root access, and Python and Git installed:

    cd
    git clone https://github.com/andymccurdy/redis-py.git redis-py
    cd redis-py
    sudo python setup.py install
    

    Behind the scenes, redis-py uses a connection pool to manage
    connections to a Redis server. By default, each Redis instance you
    create will in turn create its own connection pool. You can override
    this behavior and use an existing connection pool by passing an
    already created connection pool instance to the connection_pool
    argument of the Redis class.

    Example (save it as delkeys.py):

    #!/usr/bin/python
    import redis
    
    pool = redis.ConnectionPool(host='localhost', port=6379, db=0)
    r = redis.Redis(connection_pool=pool)
    keys = r.keys()
    for key in keys:
        if key<>"game" and key<>"people" and key<>"said":
            r.del(key)
    

    Take this with the reminder that I haven’t tested, but your comments may shape the final solution or you can go from here. Always monitor in redis-cli to be sure.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to delete all foreign keys of a table. First I get all
i am trying to delete some files using a batch file.. (winxp) my problem
I am trying to use MAXScript to delete all animation Keys from my scene
I'm trying to delete all tables from a database except one, and I end
I have log file in which I'm trying to delete all entries older than
I'm trying to delete all digits from a string. However the next code deletes
I am trying to delete the all but the most recent 3,000 items in
I am trying to delete a project from the projects table and all the
I'm trying to delete several working copy directories, but I get an Access Denied
I am using C++ hash_map to store some C-style string pairs. And all keys

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.