No model named _socket

A

Arend Sluis

Hi,

**obligatory python newbie warning*

I have been trying to install python 2.3.2 on Solaris 2.7 (SPARC). Both
'configure' and 'make' do not give problems, but 'make test' does complain:

7 tests failed:
test___all__ test_logging test_mimetools test_socket test_sundry
test_tempfile test_urllib2

All but test_tempfile can be traced back to the error:

ImportError: No module named _socket

I have been digging through the FAQ and the bug list, but I cannot find
anything helpful. Any help is welcome. (I can provide more details, if
necessary.)
 
E

Eric Brunel

Arend said:
Hi,

**obligatory python newbie warning*

I have been trying to install python 2.3.2 on Solaris 2.7 (SPARC). Both
'configure' and 'make' do not give problems, but 'make test' does complain:

7 tests failed:
test___all__ test_logging test_mimetools test_socket test_sundry
test_tempfile test_urllib2

All but test_tempfile can be traced back to the error:

ImportError: No module named _socket

I have been digging through the FAQ and the bug list, but I cannot find
anything helpful. Any help is welcome. (I can provide more details, if
necessary.)

I just got (and solved) the same problem. What you should do is the following:
- Go to your Modules directory and edit the file Setup
- In this file, search for _socket and uncomment the line for the module (the
one looking like "_socket socketmodule.c")
- Retry running "make"; if it works, you're done. If it doesn't (and it probably
won't...;-), read on.
- If the compile errors you got on socketmodule.c concerned macros AF_INET6 and
INET_ADDRSTRLEN, make the following changes in the file (in this order):
.. at line 317, add the following lines:
#if defined(__sun) && ! defined(INET_ADDRSTRLEN)
#define INET_ADDRSTRLEN 16
#endif
.. the line 2975 should be a "#ifdef ENABLE_IPV6"; change it to:
#if defined(ENABLE_IPV6) && defined(AF_INET6)

If our problems were the same, this should make things work. You may have to
reconfigure your Python installation using the flag --disable-ipv6.

For Python-guys: the modifications above are indeed a quick and dirty hack, but
actually make the "socket" module work on Solaris 7. Maybe they should be
included in the next release.
 
A

Arend Sluis

Your suggestions worked (I did not need to fiddle with the configuration
and --disable-ipv6 flag). Just for completeness, the line 2975 of
socketmodule.c (after addition at line 317) actually reads
#ifndef ENABLE_IPV6

Thanks for your help!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top