I have this one code, where I have to catch a specific error code. (I'm using win xp)
data = connection.recv (8048)
without any error catching, I get error message:
"error: (10035, "The socket operation could not complete without blocking")
I need to identify this error message 10035 in my code but dont know how to do it.
I tried:
[code=python]
try:
data = connection.recv (8048)
except (error):
print error
[/code]
it now prints <class 'socket error'> , and I want it to print that 10035error (and then handle it ofcourse)
I get somewhere the following code, but this doesn't work either:
[code=python]
import errno
...
try:
data = connection.recv (8048)
except, (error,message) :
print error
if error == errno.WSAEWOULD BLOCK:
print "10035 error found, doing something..."
[/code]
I don't understand that "," mark after the except, so the code gives me syntax error right away because of that... but in the code the error message should be a tuplet which I save to these variables and then see if the error code matches errno.WSAEWOULD BLOCK (that's the (windows) error 10035)
could anyone help me? =)
data = connection.recv (8048)
without any error catching, I get error message:
"error: (10035, "The socket operation could not complete without blocking")
I need to identify this error message 10035 in my code but dont know how to do it.
I tried:
[code=python]
try:
data = connection.recv (8048)
except (error):
print error
[/code]
it now prints <class 'socket error'> , and I want it to print that 10035error (and then handle it ofcourse)
I get somewhere the following code, but this doesn't work either:
[code=python]
import errno
...
try:
data = connection.recv (8048)
except, (error,message) :
print error
if error == errno.WSAEWOULD BLOCK:
print "10035 error found, doing something..."
[/code]
I don't understand that "," mark after the except, so the code gives me syntax error right away because of that... but in the code the error message should be a tuplet which I save to these variables and then see if the error code matches errno.WSAEWOULD BLOCK (that's the (windows) error 10035)
could anyone help me? =)
Comment