No model named _socket

Eric Brunel eric.brunel at pragmadev.N0SP4M.com
Tue Oct 28 12:15:49 EST 2003


Arend Sluis wrote:
> 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.
-- 
- Eric Brunel <eric dot brunel at pragmadev dot com> -
PragmaDev : Real Time Software Development Tools - http://www.pragmadev.com





More information about the Python-list mailing list