gmr / rabbitpy

A pure python, thread-safe, minimalistic and pythonic RabbitMQ client library
http://rabbitpy.readthedocs.org
BSD 3-Clause "New" or "Revised" License
243 stars 58 forks source link

AttributeError: 'Parsed' object has no attribute 'port'` #10

Closed eandersson closed 10 years ago

eandersson commented 11 years ago

Hey,

I tried out the latest master, and I am unable to open a connection on Python 2.7.4 (Linux Mint 15).

This is some basic testing code, and it worked before I upgraded from 0.9.

connection_string = 'amqp://{0}:{1}@{2}:{3}/%2f'.format(self.username,
                                                                self.password,
                                                                self.host,
                                                                self.port)

self.connection = rabbitpy.Connection(connection_string)

The error looks like this.

File "/usr/local/lib/python2.7/dist-packages/rabbitpy/connection.py", line 85, in __init__
    self._args = self._process_url(url or self.DEFAULT_URL)
  File "/usr/local/lib/python2.7/dist-packages/rabbitpy/connection.py", line 428, in _process_url
    port = parsed.port or (self.PORTS['amqps'] if parsed.scheme == 'amqps'
AttributeError: 'Parsed' object has no attribute 'port'

I assume that it is supposed to be listed in the namedtuple, or removed/modified from the connection.py code.

Parsed = collections.namedtuple('Parsed',
                                'scheme,netloc,url,params,query,fragment')
gmr commented 10 years ago

This is fixed in master, thanks for the error report!