[Python] Python Websockets Module has no attribute

Discussão em 'Python' iniciado por Stack, Fevereiro 26, 2025.

  1. Stack

    Stack Membro Participativo

    I have this python script that sends a WebSocket message to my python server. But it keeps throwing errors. I have seen these errors before, but I can't seem to fix it. I use the 2.7.x version.

    #!/usr/bin/python
    import websocket
    import sys
    val = sys.argv[1]
    ws = websocket.create_connection("ws://ipaddress:9001")
    ws.send(val)
    ws.close()


    The Error

    Traceback (most recent call last):
    File "./test.py", line 5, in <module>
    ws = websocket.create_connection("ws://ipaddress:9001")
    AttributeError: 'module' object has no attribute 'create_connection'

    Continue reading...

Compartilhe esta Página