Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #97258
| Date | 2015-10-01 07:30 +1000 |
|---|---|
| From | Cameron Simpson <cs@zip.com.au> |
| Subject | Re: ConnectionError handling problem |
| References | <ff56fdf3-e40b-4ebf-8f4a-524f3ce61fbd@googlegroups.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.278.1443649730.28679.python-list@python.org> (permalink) |
On 29Sep2015 23:04, shiva upreti <katewinslet626@gmail.com> wrote: >On Friday, September 25, 2015 at 12:55:01 PM UTC+5:30, Cameron Simpson wrote: >> Ok. You original code says: >> >> try: >> r=requests.post(url, data=query_args) >> except: >> print "Connection error" >> >> and presumably we think your code is hanging inside the requests.post call? You >> should probably try to verify that, because if it is elsewhere you need to >> figure out where (lots of print statements is a first start on that). >> I would open two terminals. Run your program until it hangs in one. [...various things to do to check _exactly_ where the hang is occurring...] > >Yes I use ubuntu 14.04. I will try what you suggested. But I cant understand >one thing, for whatever reason the script is hanging, why does it resumes >almost instantaneously when I press CTRL+C. Most likely the Ctrl-C interrupts whatever system call is hanging, causing it to return (failed, probably with errno EINTR). And the python program resumes because the OS system call has returned. Cheers, Cameron Simpson <cs@zip.com.au>
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: ConnectionError handling problem Cameron Simpson <cs@zip.com.au> - 2015-09-25 09:25 +1000
Re: ConnectionError handling problem shiva upreti <katewinslet626@gmail.com> - 2015-09-24 20:57 -0700
Re: ConnectionError handling problem Cameron Simpson <cs@zip.com.au> - 2015-09-25 14:59 +1000
Re: ConnectionError handling problem shiva upreti <katewinslet626@gmail.com> - 2015-09-24 22:46 -0700
Re: ConnectionError handling problem Cameron Simpson <cs@zip.com.au> - 2015-09-25 17:24 +1000
Re: ConnectionError handling problem shiva upreti <katewinslet626@gmail.com> - 2015-09-29 23:04 -0700
Re: ConnectionError handling problem Cameron Simpson <cs@zip.com.au> - 2015-10-01 07:30 +1000
Re: ConnectionError handling problem Laura Creighton <lac@openend.se> - 2015-09-30 23:56 +0200
csiph-web