Sending message via Python + xmpppy: AttributeError in minimal example
Question: I found in a related question a minimal example to send a message via
xmpp(py); see below. But when I execute the script I get the following error:

    
    
       client = xmpp.Client('gmail.com')
    AttributeError: 'module' object has no attribute 'Client'
    

I'm working with Eclipse and PyDev, and xmpppy should definitely be installed.
The Interpreter includes /usr/local/lib/python2.7/dist-packages/ and when
looking there I find

    
    
     /usr/local/lib/python2.7/dist-packages/xmpppy-0.5.0rc1-py2.7.egg
     /usr/local/lib/python2.7/dist-packages/xmpppy-0.5.0rc1-py2.7.egg/xmpp
    

help('modules') also shows me the xmpp module. When using the autocomplete
function (CTRL + SPACE) in Eclipse/PyDev I can actually 'see' the client.
Still, I get the AttributeError. I guess I'm missing something really stupid
here.

Thanks,

Christian

    
    
    import xmpp
    
    username = 'username'
    passwd = 'password'
    to='name@example.com'
    msg='hello :)'
    
    client = xmpp.Client('gmail.com')
    client.connect(server=('talk.google.com',5223))
    client.auth(username, passwd, 'botty')
    client.sendInitPresence()
    message = xmpp.Message(to, msg)
    message.setAttr('type', 'chat')
    client.send(message)
    


Answer: You've named a script `xmpp.py`. You're accidentally `import`ing it instead of
the real `xmpp` module.

Rename the script and everything should work fine.

