Python cannot initialize socket object

I am unable to initiate socket objects in Python.

import socket
socket.socket(socket.AF_INET, socket.SOCK_STREAM)

And I get a traceback in the init function

_socket.socket.__init__(self, family, type, proto, fileno)
OSError: [WinError 10022] An invalid argument was supplied

There seems to be very little information on what may be causing this. Any ideas on what the issue is here?

EDIT: I have fixed the caps in the question text as it was a typo. It was correct in my code editor however, and regardless, even this fails:

import socket

enter image description here

1 answer

  • answered 2019-07-10 22:45 Sean Tashlik


        socket.socket(socket.AF_INET, socket.SOCK_STREAM)