Given that you get interrupci¾n
instead of interrupción
I think I'm not wrong to think you're in Windows.
Python does not offer mechanisms to translate the messages of its exceptions, which always come in English. Apparently the error message in this case is specific to Windows, which is the one that handles "below" the sockets. Probably python, to ignore the particularities of the platform on which it is running, is limited to printing the error code number and the explanatory message that Windows reports.
You can change the default Windows language, and that will surely change the message.
You can capture the socket.error
exception, examine the message string looking for a certain numeric code and raise another exception with the translated message. Something like this:
try:
# Codigo que maneja sockets
except socket.error, e:
if 'Errno 10054' in str(e):
raise socket.error("[Errno 10054] An existing connection was forcibly closed by the remote host")
But better still you should not do anything . It is assumed that exception messages should never be visible to the end user, since your application must handle those exceptions appropriately (except perhaps during the development phase, in which the language in which they appear is not very important). ).