What is the Broker you are using and what is the OS?
By default all MQTT Broker should run on 0.0.0.0 IP making it available for all the local loopback addresses and the public IP of the machine. But on the client side you should use either the IP Address or the localhost address and you cannot use 0.0.0.0 in your client.
There may be some firewall restrictions added in your OS for the localhost for connecting.
Try doing telnet localhost 1883 or telnet 127.0.0.1 1883. If this connection happens, the Paho client should be able to connect.
Cheers,
Ranjith
Bevywise Networks.