Skip to content

issue with SUBSCRIBE and pipes #30

Closed
@thomasst

Description

@thomasst
Sample code:

redis = Redis()

# If I enable this line it works (i.e. executing any redis command before executing the pipe). This shouldn't be required though.
#redis.exists('z')

pipe = redis.pipeline()
pipe.subscribe('z')
print 'exec', pipe.execute()

for msg in pipe.listen():
    print msg


Output:

Traceback (most recent call last):
  File "sub.py", line 14, in 
    print 'exec', pipe.execute()
  File "/home/tom/lib/redis/client.py", line 1151, in execute
    return execute(stack)
  File "/home/tom/lib/redis/client.py", line 1113, in _execute_transaction
    self.connection.send(all_cmds, self)
  File "/home/tom/lib/redis/client.py", line 81, in send
    self.connect(redis_instance)
  File "/home/tom/lib/redis/client.py", line 66, in connect
    redis_instance._setup_connection()
  File "/home/tom/lib/redis/client.py", line 395, in _setup_connection
    self.execute_command('SELECT', self.connection.db)
  File "/home/tom/lib/redis/client.py", line 302, in execute_command
    **options
  File "/home/tom/lib/redis/client.py", line 1100, in _execute_command
    command_name, command, **options)
  File "/home/tom/lib/redis/client.py", line 278, in _execute_command
    raise RedisError("Cannot issue commands other than SUBSCRIBE and "
redis.exceptions.RedisError: Cannot issue commands other than SUBSCRIBE and UNSUBSCRIBE while channels are open

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions