ConnectionError handling problem

shiva upreti katewinslet626 at gmail.com
Fri Sep 25 01:46:20 EDT 2015


On Friday, September 25, 2015 at 10:55:45 AM UTC+5:30, Cameron Simpson wrote:
> On 24Sep2015 20:57, shiva upreti <katewinslet626 at gmail.com> wrote:
> >Thank you Cameron.
> >I think the problem with my code is that it just hangs without raising any exceptions. And as mentioned by Laura above that when I press CTRL+C, it just catches that exception and prints ConnectionError which is definitely a lie in this case as you mentioned.
> 
> Update it to report the _actual_ exception received. (If any.) At least then 
> you will be sure.
> 
> >As my code doesnt raise any exception by itself, instead just hangs,
> 
> So, no "ConnectionError" message?
> 
> >I wont be able to characterize the exceptions and handle them individually.
> 
> Can you repost you code once it is modified to display the precise exception.
> 
> Note that one easy way to catch all but progressively handle specific 
> exceptions looks like this:
> 
>   try:
>      ... code ...
>   except OSError as e:
>     print OSError received, specifics are:", e
>   except Exception as e:
>     print "unhandled exception:", e
>     break
> 
> and so on, inserting the exception types _above_ the final "except" as you add 
> actions for them.
> 
> Cheers,
> Cameron Simpson <cs at zip.com.au>

Hi Cameron.
I think you may have misunderstood my problem.
When my code runs it doesnt throw any exception. It just hangs(stops executing) for unknown reasons. I want to know why. It doesnt even throw ConnectionError unless I press CTRL+C(only because I hard coded ConnectionError).
I can repost the whole problem again if you want me to.
Thanks.:)




More information about the Python-list mailing list