python26 can't import socket module

Michael Dippery mpd at
Mon Jun 22 14:01:35 PDT 2009

I recently installed MacPort's python26 port. I am now unable to use  
Django's script; it fails with the error "Error: cannot  
import name SSLError" (I have tried with both py25-django and py26- 
django installed).

The problem occurs when a piece of Django code tries to access  
socket.sslerror. I fired up Python 2.6, and got the following error  
when I tried to "import socket":

Python 2.6.2 (r262:71600, Jun 22 2009, 15:02:00)
[GCC 4.0.1 (Apple Computer, Inc. build 5367)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
 >>> import socket
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/ 
lib/python2.6/", line 64, in <module>
     from _ssl import SSLError as sslerror
ImportError: cannot import name SSLError

The python25 port used to have a py25-socket-ssl port which I believe  
may have fixed this problem, but, of course, that port no longer  
exists for python26 (the SSL socket stuff is supposedly included in  
python26). Is there a reason this doesn't work, and moreover, how do  
I fix it?

Michael Dippery
Systems Programmer
CEES, Rensselaer Polytechnic Institute
W: (518) 276-8143
E: mpd at

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
URL: <>

More information about the macports-users mailing list