Reputation: 310
I am trying to connect RabbitMQ from Python. Here is the below code I am using
connection = pika.SelectConnection(parameters, self.on_connection_open, self.on_open_error_callback,
stop_ioloop_on_close=False)
I setup the configuration in RabbitMQ and copied the same in Python code also. But when running it throws the below error.
TypeError: _ _init_ _() got an unexpected keyword argument 'stop_ioloop_on_close'
Can anyone help me to fix this issue. For your information, I am using the latest versions of all the softwares.
Thanks in advance!!
Upvotes: 1
Views: 749
Reputation: 4849
If you don't want to downgrade your version you can just remove the stop_ioloop_on_close
argument. Since the functionality should have remained the same (i.e. now it's no longer checking what to do on close, so it will keep running).
If you want do want to close the connection you can use the on_close_callback
parameter to call connection.ioloop.stop()
yourself if needed.
Upvotes: 1
Reputation: 26352
The problem is that the argument was removed in version 1.0.0 because of this issue. You should lock down the requirements to always make sure a version older than 1.0 is installed.
e.g.
Add something like this to the requirements file of your project.
pika<1.0
In addition it's probably worth looking into having the code fixed, and then removing the version restriction.
Upvotes: 2
Reputation: 310
For this issue, need to downgrade pika version to 0.11.2 and the recent versions throwing this error.
Upvotes: 2