Score:0

Why am I receiving this "pika.exceptions.AMQPConnectionError"?

mo flag

I have been trying to run a file named "send.py" to send a message to the queue in RabbitMQ. Whenever I try to run this file I receive a "pika.exceptions.AMQPConnectionError". I do not have RabbitMQ installed and cannot use it for this project. I have another device that has RabbitMQ installed that has to receive the message I send to queue by running a "receive.py" file. I have been informed that I need a "AMQP Library" installed but I already have "pika" installed. I am not sure how to solve this issue. Any help would be appreciated.

Here is the error:

Traceback (most recent call last):
  File "/home/user/file/send.py", line 6, in <module>
    connection = pika.BlockingConnection(
  File "/usr/local/lib/python3.10/dist-packages/pika/adapters/blocking_connection.py", line 360, in __init__
    self._impl = self._create_connection(parameters, _impl_class)
  File "/usr/local/lib/python3.10/dist-packages/pika/adapters/blocking_connection.py", line 451, in _create_connection
    raise self._reap_last_connection_workflow_error(error)
pika.exceptions.AMQPConnectionError

Here is my code for send.py:

#!/usr/bin/env python
import pika

credentials = pika.PlainCredentials(username='username', password='password')

connection = pika.BlockingConnection(
    pika.ConnectionParameters(host='ipaddress', credentials=credentials))

channel = connection.channel()

channel.queue_declare(queue='Hello')

channel.basic_publish(exchange='', routing_key='Hello', body='Hey!')
print(" [x] Sent 'Hello World!' ")
connection.close()
ChanganAuto avatar
us flag
https://stackoverflow.com/questions/55718163/program-running-pika-throwing-amqpconnectionerror
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.