title: Getting “pika.exceptions.ConnectionClosed” error while using rabbitmq in python
body: <p>I am trying to use rabbitmq in python.
  My code is:</p>
  
  <pre><code>import pika
  
  if __name__ == '__main__':
      connection = pika.BlockingConnection(pika.ConnectionParameters(host='localhost'))
  </code></pre>
  
  <p>I am running this file using:</p>
  
  <pre><code>python3 test.py
  </code></pre>
  
  <p>Error Signature:</p>
  
  <pre><code>Traceback (most recent call last):
    File "Test.py", line 4, in &lt;module&gt;
      connection = pika.BlockingConnection(pika.ConnectionParameters(host='localhost'))
    File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pika/adapters/blocking_connection.py", line 339, in __init__
      self._process_io_for_connection_setup()
    File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pika/adapters/blocking_connection.py", line 374, in _process_io_for_connection_setup
      self._open_error_result.is_ready)
    File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pika/adapters/blocking_connection.py", line 395, in _flush_output
      raise exceptions.ConnectionClosed()
  pika.exceptions.ConnectionClosed
  </code></pre>
  
  <p>Already referred <a href="https://stackoverflow.com/questions/22061082/getting-pika-exceptions-connectionclosed-error-while-using-rabbitmq-in-python">this</a> , but i dont have any sleep in my code.
  Not really sure what could go wrong.
  Please let me know if I am missing something obvious.</p>