title: Python-xmpp HostUnknown error during connect
body: <p>There are other questions the same but none have a clear answer that actually functions.  I am trying to send a chat message via python-xmpp:</p>
  
  <pre><code>import xmpp
  
  username = 'test@server.com'
  passwd = 'password'
  to='test2@server.com'
  msg='hello :)'
  
  
  client = xmpp.Client('Adium')
  client.connect(server=('server.com',5222))
  client.auth(username, passwd, 'botty')
  client.sendInitPresence()
  message = xmpp.Message(to, msg)
  message.setAttr('type', 'chat')
  client.send(message)
  </code></pre>
  
  <p>However I do not understand the error that is returned:</p>
  
  <pre><code>Invalid debugflag given: always
  Invalid debugflag given: nodebuilder
  DEBUG: 
  DEBUG: Debug created for /usr/lib/python2.7/dist-packages/xmpp/client.py
  DEBUG:  flags defined: always,nodebuilder
  An error occurred while looking up _xmpp-client._tcp.server.com
  DEBUG: socket       start Plugging &lt;xmpp.transports.TCPsocket instance at 0xc04940&gt; into &lt;xmpp.client.Client instance at 0xc04350&gt;
  DEBUG: socket       start Successfully connected to remote host ('server.com', 5222)
  DEBUG: dispatcher   start Plugging &lt;xmpp.dispatcher.Dispatcher instance at 0xc04af8&gt; into &lt;xmpp.client.Client instance at 0xc04350&gt;
  DEBUG: dispatcher   info  Registering namespace "unknown"
  DEBUG: dispatcher   info  Registering protocol "unknown" as xmpp.protocol.Protocol(unknown)
  DEBUG: dispatcher   info  Registering protocol "default" as xmpp.protocol.Protocol(unknown)
  DEBUG: dispatcher   info  Registering namespace "http://etherx.jabber.org/streams"
  DEBUG: dispatcher   info  Registering protocol "unknown" as xmpp.protocol.Protocol(http://etherx.jabber.org/streams)
  DEBUG: dispatcher   info  Registering protocol "default" as xmpp.protocol.Protocol(http://etherx.jabber.org/streams)
  DEBUG: dispatcher   info  Registering namespace "jabber:client"
  DEBUG: dispatcher   info  Registering protocol "unknown" as xmpp.protocol.Protocol(jabber:client)
  DEBUG: dispatcher   info  Registering protocol "default" as xmpp.protocol.Protocol(jabber:client)
  DEBUG: dispatcher   info  Registering protocol "iq" as xmpp.protocol.Iq(jabber:client)
  DEBUG: dispatcher   info  Registering protocol "presence" as xmpp.protocol.Presence(jabber:client)
  DEBUG: dispatcher   info  Registering protocol "message" as xmpp.protocol.Message(jabber:client)
  DEBUG: dispatcher   info  Registering handler &lt;bound method Dispatcher.streamErrorHandler of &lt;xmpp.dispatcher.Dispatcher instance at 0xc04af8&gt;&gt; for "error" type-&gt; ns-&gt;(http://etherx.jabber.org/streams)
  DEBUG: dispatcher   warn  Registering protocol "error" as xmpp.protocol.Protocol(http://etherx.jabber.org/streams)
  DEBUG: socket       sent  &lt;?xml version='1.0'?&gt;
    &lt;stream:stream xmlns="jabber:client" to="Adium" version="1.0" xmlns:stream="http://etherx.jabber.org/streams" &gt;
  DEBUG: socket       got   &lt;?xml version='1.0'?&gt;
    &lt;stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' id='4001548908' from='server.com' xml:lang='en'&gt;
    &lt;stream:error&gt;
    &lt;host-unknown xmlns='urn:ietf:params:xml:ns:xmpp-streams'/&gt;
    &lt;/stream:error&gt;
    &lt;/stream:stream&gt;
  DEBUG: dispatcher   ok    Got http://etherx.jabber.org/streams/error stanza
  DEBUG: dispatcher   ok    Dispatching error stanza with type-&gt; props-&gt;[u'urn:ietf:params:xml:ns:xmpp-streams'] id-&gt;None
  Traceback (most recent call last):
    File "chat2.py", line 10, in &lt;module&gt;
      client.connect(server=('server.com',5222))
    File "/usr/lib/python2.7/dist-packages/xmpp/client.py", line 200, in connect
      if not CommonClient.connect(self,server,proxy,secure,use_srv) or secure&lt;&gt;None and not secure: return self.connected
    File "/usr/lib/python2.7/dist-packages/xmpp/client.py", line 184, in connect
      if not self.Process(1): return
    File "/usr/lib/python2.7/dist-packages/xmpp/dispatcher.py", line 303, in dispatch
      handler['func'](session,stanza)
    File "/usr/lib/python2.7/dist-packages/xmpp/dispatcher.py", line 215, in streamErrorHandler
      raise exc((name,text))
  xmpp.protocol.HostUnknown: (u'host-unknown', '')
  </code></pre>
  
  <p>I can see that I am successfully connecting to the server, but after that it makes no sense.  I suspect problems with the "client" in client = xmpp.Client('Adium') but not sure what should go there or if it is even an issue. What do you think?</p>
  
  <p>I am using python-xmpp on python 2.7 and wonder if this is not compatible or something.</p>