回溯(最近通话最近一次):
文件
中的“ download_image_from_queue.py”,第44行channel.start_consuming()
文件“ /home/justdial/miniconda3/lib/python3.7/site-packages/pika/adapters/blocking_connection.py”,行1866,在start_using中
self._process_data_events(time_limit=None)
文件_process_data_events中的文件“ /home/justdial/miniconda3/lib/python3.7/site-packages/pika/adapters/blocking_connection.py”,第2027行
self.connection.process_data_events(time_limit=time_limit)
process_data_events中的文件“ /home/justdial/miniconda3/lib/python3.7/site-packages/pika/adapters/blocking_connection.py”,第825行
self._flush_output(common_terminator)
_flush_output中的文件“ /home/justdial/miniconda3/lib/python3.7/site-packages/pika/adapters/blocking_connection.py”,第522行
raise self._closed_result.value.error
pika.exceptions.StreamLostError: Stream connection lost: ConnectionResetError(104, 'Connection reset by peer'
文件“ download_image_from_queue.py”:
def callback(ch, method, properties, body):
default_flag = True
try:
data = json.loads(body.decode("utf-8"))['DATA']
url = data['url']
dest_name = data['dest_name']
default_flag = False
except:
print ("\n INCORRECT DATA FORMAT INSERTED INTO THE QUEUE... \n")
pass
if default_flag == False:
os.system("cd /home/images_pred/ && wget -L --timeout=3 --tries=2 {} -O {}".format(url, dest_name))
print ('\n Waiting for the queue to be filled... PRESS CTRL+C TO STOP \n')
credentials = pika.PlainCredentials('abcd', 'BCD')
parameters = pika.ConnectionParameters('0.0.0.1', 5672, '/', credentials )
connection = pika.BlockingConnection(parameters)
channel = connection.channel()
#channel.basic_qos(prefetch_count = 1)
channel.basic_consume(queue = 'IMG_DOWNLOAD', auto_ack = False, on_message_callback = callback)
#channel.basic_ack()
print ('\n Waiting for the queue to be filled... PRESS CTRL+C TO STOP \n')
channel.start_consuming()
一旦开始使用它,它就会开始下载,但很快就会出现此错误“ pika.exceptions.StreamLostError:流连接丢失:ConnectionResetError(104,'对等重置连接')”
有人可以帮我吗?