Skip to content
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

code() takes at most 15 arguments when running any command. #13

Open
scuml opened this issue Sep 29, 2020 · 1 comment
Open

code() takes at most 15 arguments when running any command. #13

scuml opened this issue Sep 29, 2020 · 1 comment

Comments

@scuml
Copy link

scuml commented Sep 29, 2020

Getting an error no matter what I run or register through gearsclient.

Even noop code like:

gb = GearsBuilder('KeysOnlyReader', r=conn)
gb.run()

returns

Traceback (most recent call last):
  File "<input>", line 1, in <module>
    gb3.run()
  File "/Users/<user>/Library/Caches/pypoetry/virtualenvs/gears-5k_d3sYO-py3.8/lib/python3.8/site-packages/gearsclient/redisgears_builder.py", line 314, in run
    ''' % selfBytes
  File "/Users/<user>/Library/Caches/pypoetry/virtualenvs/gears-5k_d3sYO-py3.8/lib/python3.8/site-packages/redis/client.py", line 901, in execute_command
    return self.parse_response(conn, command_name, **options)
  File "/Users/<user>/Library/Caches/pypoetry/virtualenvs/gears-5k_d3sYO-py3.8/lib/python3.8/site-packages/redis/client.py", line 915, in parse_response
    response = connection.read_response()
  File "/Users/<user>/Library/Caches/pypoetry/virtualenvs/gears-5k_d3sYO-py3.8/lib/python3.8/site-packages/redis/connection.py", line 756, in read_response
    raise response
redis.exceptions.ResponseError: ['Traceback (most recent call last):\n', '  File "<string>", line 3, in <module>\n', 'TypeError: code() takes at most 15 arguments (16 given)\n']

conn.execute_command("RG.PYEXECUTE", "GB().run()"). works fine.

Running on python 3.8 on Mac OS 10.15.5 connecting to current RedisGears docker image. I did manually change .dumps() in the library to use pickle protocol 4 since python 3.8 defaults to protocol 5 which doesn't exist in the RedisGear docker image using python 3.7.
eg: selfBytes = cloudpickle.dumps(self.pipe, protocol=4)

@MeirShpilraien
Copy link
Collaborator

@scuml thanks for reporting, seems like on python 3.8, a new field was added to the code object calls co_posonlyargcount.
You can see the differences in the definitions here:
https://docs.python.org/3/library/inspect.html
https://docs.python.org/3.7/library/inspect.html

When you use python3.8, it serializes this value, but python3.7 does not expect this value and it raises this error. I will dig further to try to find a workaround but until then you will have to switch to Python 3.7 or not using this library and just send your python code as text using RG.PYEXECUTE command.

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

2 participants