You need to enable logging of a connection error. With high chances there is required TLS by default but your server (local?) doesn't have the TLS enabled.
Check the slixmpp.connect()
sources:
See the force_starttls: bool = True
param. It will not connect if the server doesn't have TLS enabled and rejects the START TLS
command.So try to specify the param to False.
As a side recommendation check Gajim sources which is also written in Python.