title: Paho mqtt client not working properly
body: <p>I'm new to MQTT and raspberry pi! I'm running a client script and I simply publish a message using another script. I'm using my own Mosquitto broker.</p>
  
  <p>Client: </p>
  
  <pre><code>import paho.mqtt.client as mqtt
  
  def on_connect(client, userdata, flags, rc):
      print("Connected with result code "+str(rc))
  
      client.subscribe("Example/test")
      client.subscribe("Example/topic")
  
  
  def on_message(client, userdata, msg):
  
      print(msg.topic+" "+str(msg.payload))
  
  
      if msg.payload == "Hello":
          print("Received message #1, do something")
  
      if msg.payload == "World":
          print("Received message #2, do something else")
  
  
  client = mqtt.Client()
  client.on_connect = on_connect
  client.on_message = on_message
  
  client.connect("192.168.1.4", 1883)
  
  
  client.loop_forever()
  </code></pre>
  
  <p>Publisher:</p>
  
  <pre><code>import paho.mqtt.publish as publish
  
  
  publish.single("Example/test", "Hello", hostname="192.168.1.4")
  publish.single("Example/topic", "World", hostname="192.168.1.4")
  
  print("OK")
  </code></pre>
  
  <p>That's where things seem weird and those things happen.
  1.When I run both the client and the publisher using the python3 command the if statements are skipped and only topic + payload are printed
  2.When I run the client using python command and publisher using both python3 and python command everything works fine!
  3.When I do all the above, while running the client on virtualenv again the if statements are ignored, in all occasions!  </p>
  
  <p>I would like to know if there is a compatibility reason for this to happen, or anything wrong in the code as I must run something more complicated like that on virtualenv!</p>
  
  <hr>
  
  <p>UPDATE: I found a solution that works fine ! 
  In the client code in the if statement I used </p>
  
  <pre><code>if msg.payload == b"Hello":
  </code></pre>
  
  <p>and</p>
  
  <pre><code>if msg.payload == b"World":
  </code></pre>
  
  <p>As far as I know it must have been due to a variable type thing and they  didn't match. </p>