Not specifying the port raises exception even though it seems like it shouldn't.

Bug #1083072 reported by on 2012-11-26
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Python Memcached

Bug Description

>>> import memcache
>>> memcache.Client([''])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/kitsunde/.virtualenvs/media-pop/lib/python2.7/site-packages/", line 195, in __init__
  File "/Users/kitsunde/.virtualenvs/media-pop/lib/python2.7/site-packages/", line 239, in set_servers
    for s in servers]
  File "/Users/kitsunde/.virtualenvs/media-pop/lib/python2.7/site-packages/", line 1058, in __init__
    self.port = int(hostData.get('port', 11211))
TypeError: int() argument must be a string or a number, not 'NoneType'
>>> memcache.Client([''])
<memcache.Client object at 0x106474a10>

It seems like it should default to port 11211, but that hostData['port'] has already been set to None.

Sean Reifschneider (jafo) wrote :

I can't reproduce this:

guin:python-memcached$ python
Python 2.7.3 (default, Sep 26 2012, 21:53:58)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import memcache
>>> memcache.Client([''])
<memcache.Client object at 0xb74bfa7c>
>>> memcache.Client([''])
<memcache.Client object at 0xb74bfaac>
>>> memcache.Client([''])
<memcache.Client object at 0xb74bfadc>

Changed in python-memcached:
status: New → Incomplete

For the historical purposes: this was fixed in and included in version 1.50 and above. Hovewer, RHEL/CentOS 7 still has python-memcached-1.48-4.el7.noarch and that's why I hit this. I believe this can be safely closed now.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers