0

I can't import socket module into my program. When I import it said, "AttributeError: 'module' object has no attribute "AF_INET'. I think there is a problem with my python virtual machine.

inspectorG4dget
115k30 gold badges159 silver badges253 bronze badges
asked Jan 27, 2013 at 6:49
1
  • 2
    A common problem is naming your file something that would cross with the module. What did you name your file? Also, could you post your code? Commented Jan 27, 2013 at 6:50

2 Answers 2

0

Mostly It is looking like Either naming problem or path problem.You can try to run your program from another location as did by this Python Socket Problem

Or if it is a naming problem then maybe you are using some standard names in your code, which are clashes with system ones Socket isn't working in Python and Python Error

answered Jan 27, 2013 at 7:08
Sign up to request clarification or add additional context in comments.

Comments

0

Rule of thumb in users' created python modules, never give your modules the same python's standard modules names; instant conflict will occur.

eg. If you name your socket app "socket.py", and started your application, similar problem to what you showed will appear.

answered Jan 27, 2013 at 8:42

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.