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

TypeError when calling 'get_many' on HashClient with Unix socket location #314

Closed
bombedhair opened this issue May 5, 2021 · 1 comment · Fixed by #315
Closed

TypeError when calling 'get_many' on HashClient with Unix socket location #314

bombedhair opened this issue May 5, 2021 · 1 comment · Fixed by #315
Labels

Comments

@bombedhair
Copy link

bombedhair commented May 5, 2021

from pymemcache.client.hash import HashClient

client = HashClient(['/path/to/memcached.socket', ])
client.get_many(['ITEM_A', 'ITEM_B'])

Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "/path/to/venv/lib/python3.9/site-packages/pymemcache/client/hash.py", line 413, in get_many
    if gets:
TypeError: not enough arguments for format string

At line 409 of /pymemcache/client/hash.py

client = self.clients['%s:%s' % server]

Since server is a str of Unix socket location in this case, not the tuple that contains IP and PORT, TypeError: not enough arguments for format string happens when using get_many and set_many.

Should be like

if isinstance(server, six.string_types):
    client = self.clients[server]
else:
    client = self.clients['%s:%s' % server]

or restricting Unix Socket on HashClient if it's not likely to have multiple Unix sockets (I'm not sure about this)

@jparise jparise added the bug label May 7, 2021
@jparise
Copy link
Collaborator

jparise commented May 7, 2021

@pope1ni do you have thoughts on the best way to handle this?

ngnpope added a commit to ngnpope/pymemcache that referenced this issue May 7, 2021
Overlooked when UNIX socket support was added to `HashClient` in
acd962b.

Fixes pinterest#314.
ngnpope added a commit to ngnpope/pymemcache that referenced this issue May 7, 2021
Overlooked when UNIX socket support was added to `HashClient` in
acd962b.

Fixes pinterest#314.
ngnpope added a commit to ngnpope/pymemcache that referenced this issue May 7, 2021
Overlooked when UNIX socket support was added to `HashClient` in
acd962b.

Fixes pinterest#314.
ngnpope added a commit to ngnpope/pymemcache that referenced this issue May 10, 2021
Overlooked when UNIX socket support was added to `HashClient` in
acd962b.

Fixes pinterest#314.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants