On 29Sep2015 23:04, shiva upreti <katewinslet...@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 <c...@zip.com.au>
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to