title: ImportError: No module named _socket
body: <p>I am trying to execute a small python code from CPP environment(Visual studio 2008) for test automation.  When I try to add the following code in python script <code>import socket</code>. The python code is not getting imported. I am getting the below error.</p>
  
  <pre><code>Py_initialize succeededTraceback (most recent call last):
    File "E:\Code\MSVC\PythonTest\Proj\Pythoncheck\Debug\main.py", line 2, in &lt;module&gt;
      import socket
    File "C:\Python27\Lib\socket.py", line 47, in &lt;module&gt;
      import _socket
  ImportError: No module named _socket
  </code></pre>
  
  <p>But when i execute the python script alone(<code>python main.py</code>), there is no such issue in importing socket. The python script is getting executed fine. Has anyone faced this earlier? Could anyone help me with the solution?</p>
  
  <p>The code <code>main.py</code> contains</p>
  
  <pre><code>import sys
  import socket
  
  print"santhosh"
  
  def startmain():
  
      while True:
          time.sleep(5000)
  
  
  pingcount = 0
  print "InstartMain"
  </code></pre>
  
  <p>Regards,
  Santhosh</p>