2

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
socket.socket()

enter image description here

2
  • Cannot reproduce. This question's content and history make me doubtful. Please create a minimal, reproducible example and then copy&paste that code into your question. Do not type it. Commented Jul 11, 2019 at 0:00
  • No need to be snarky just because you can't reproduce. Question is as minimal as it can possibly be, and I've added a screenshot to curb your doubts about the content and history (lol what?) Commented Jul 11, 2019 at 0:12

1 Answer 1

1

CAPS MATTER!

    socket.socket(socket.AF_INET, socket.SOCK_STREAM)
Sign up to request clarification or add additional context in comments.

1 Comment

See my edits - that was a typo in the question text, but my code had it correctly. And it still fails with socket.socket() without the args.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.