Issue2335

classification
Title: ImportError: No module named _socket
Type: behaviour Severity: critical
Components: Library Versions: Jython 2.7
Milestone:
process
Status: closed Resolution: invalid
Dependencies: Superseder:
Assigned To: Nosy List: buildhappy, zyasoft
Priority: Keywords:

Created on 2015-04-22.08:52:44 by buildhappy, last changed 2015-04-23.03:42:29 by zyasoft.

Messages
msg9922 (view) Author: buildhappy (buildhappy) Date: 2015-04-22.08:52:43
Exception in thread "main" Traceback (most recent call last):
  File "/home/xxx/develop/test-virtualen/simplyTest.py", line 4, in <module>
    import requests
  File "/home/xxx/virtualenv/py2env/lib/python2.7/site-packages/requests/__init__.py", line 58, in <module>
    from . import utils
  File "/home/xxx/virtualenv/py2env/lib/python2.7/site-packages/requests/utils.py", line 12, in <module>
    import cgi
  File "/usr/lib/python2.7/cgi.py", line 40, in <module>
    import urllib
  File "/usr/lib/python2.7/urllib.py", line 26, in <module>
    import socket
  File "/usr/lib/python2.7/socket.py", line 47, in <module>
    import _socket
ImportError: No module named _socket
msg9923 (view) Author: Jim Baker (zyasoft) Date: 2015-04-22.13:20:26
_socket module is part of Lib/, and necessary if you have been able to install pip/setuptools with ensurepip in the installation. Check your sys.path and verify that one of the entries points to your Lib directory and that Lib/_socket.py is present
msg9924 (view) Author: Jim Baker (zyasoft) Date: 2015-04-22.13:43:30
It's a path issue: in your configuration, you are including the CPython standard library, which is not compatible with Jython's version.

Specifically
"/usr/lib/python2.7/socket.py"

is not going to work at all with Jython's version.

Check your JYTHONPATH. Also when testing your config, don't run Jython in the context of the pyenv tool - this may work, as a third-party tool, but it's not something I have run and it certainly adds one more factor of complexity.
History
Date User Action Args
2015-04-23 03:42:29zyasoftsetstatus: open -> closed
2015-04-22 13:43:30zyasoftsetresolution: invalid
messages: + msg9924
2015-04-22 13:20:26zyasoftsetnosy: + zyasoft
messages: + msg9923
2015-04-22 08:52:44buildhappycreate