[Tutor] Socket Error Handling Syntax
sparkle Plenty
sparkle.plenty12481632 at gmail.com
Tue May 28 21:37:13 CEST 2013
If I use an if statement, I cannot use continue after I do my error
handling, so I am really trying to use the except errorname: instead of an
if statement. Therefore, I have to find the correct error name to identify
the 10057 condition to the interpreter, but thanks anyway, Andreas.
On Tue, May 28, 2013 at 1:25 PM, sparkle Plenty <
sparkle.plenty12481632 at gmail.com> wrote:
> Python 3.3, Windows operating system:
>
> I am communicating with a device using a Python script and I am
> coding except clauses in my send and receive functions to handle a
> particular error. I can't find a WinError example, and I can't get the
> syntax right. I have researched this and tried the following:
>
> while not_sent:
> try:
> (my socket send code)
>
> except OSError.WinError.10057
> (this failed)
> except OSError.WSAENOTCONN
> (this failed)
> except OSError.winerror.WSANOTCONN
> (this failed)
>
> I have another general except/as clause already coded and debugged for
> each function to catch unexpected errors and shut down. I need to catch
> and handle 10057 exceptions when they occur and keep running. I know 10057
> is a WinError, which is a subset of OSError, I just can't find the right
> syntax for it. I would appreciate some help on this one.
>
> Thank you.
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20130528/40331392/attachment-0001.html>
More information about the Tutor
mailing list