<span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255); "><div>#!/usr/bin/env python</div><div>import pika</div><div>import sys</div><div>import psutil</div>
<div>import json</div><div>import time</div><div><br></div><div>serverName = "salmazov"</div><div>connection = pika.AsyncoreConnection(pika.ConnectionParameters(host='192.168.0.25'))</div><div>channel = connection.channel()</div>
<div><br></div><div>channel.exchange_declare(exchange='cmd', type='topic')</div><div><br></div><div>cmd_data_queue = channel.queue_declare(exclusive=True).queue</div><div><br></div><div>channel.queue_bind(exchange='cmd', queue=cmd_data_queue, routing_key='cmd.*')</div>
<div><br></div><div>def callback(ch, method, properties, body):</div><div> print " [x] %r:%r" % (method.routing_key, body,)</div><div> procCmd = decodeddict["ProcCmd"]</div><div> proc = psutil.Popen(procCmd)</div>
<div> </div><div>channel.basic_consume(callback, queue=cmd_data_queue, no_ack=True)</div><div>pika.asyncore_loop()</div><div>--------------------------------------------</div><div><br></div><div>When I start this code -> have an error: <b>error: uncaptured python exception, closing channel <pika.asyncore_adapter.RabbitDispatcher connected at 0x12ad6c0></b></div>
<div><b><br></b></div><div>I need to run processes that arrived via RmQ</div></span>