title: Python Producer can send via shell, but not .py
body: <p>I have a running and tested Kafka cluster, and am trying to use a Python script to send messages to the brokers. This works when I use the Python3 shell and call the producer method, however when I put these same commands into a python file and execute it - the script seems to hang.</p>
  
  <p>I am using the kafka-python library for the consumer and producer. When I use the Python3 shell I can see the messages appear in the topic using Kafka GUI tool 2.0.4
  I've tried various loops and statements in the python code, but nothing seems to make it 'run' to completion.</p>
  
  <pre><code>&gt;&gt;&gt;from kafka import KafkaProducer
  &gt;&gt;&gt;producer = KafkaProducer(bootstrap_servers='BOOTSTRAP_SRV:9092')
  &gt;&gt;&gt;producer.send('MyTopic', b'Has this worked?')
  &gt;&gt;&gt;&gt;&gt;&gt;&lt;kafka.producer.future.FutureRecordMetadata object at 0x7f7af9ece048&gt;
  </code></pre>
  
  <p>And this works and bytes appears in the broker topic data.</p>
  
  <p>When I put the same code as above in a python .py file and execute with Python3 it completes, but no data is sent to Kafka broker.
  No error shown either. </p>
  
  <pre><code>from kafka import KafkaProducer
  producer = KafkaProducer(bootstrap_servers='BOOTSTRAP_SRV:9092')
  producer.send('MyTopic', b'Some Data to Check')
  </code></pre>