Uncatchable socket.error in socket.py (?)

Irmen de Jong irmen at -NOSPAM-REMOVETHIS-xs4all.nl
Tue Aug 26 20:02:40 CEST 2003

Rune wrote:
> Now, enough words: What I wonder is: Can I catch that socket.error?

By not doing

   from socket import *

but rather

   import socket

(and prefixing your code with "socket." where it's needed).

The socket.error you tried to catch is coming from the socket
object that you placed in your namespace by doing the "from"
import. And the socket class doesn't have an "error" attribute ;)


More information about the Python-list mailing list