curl / Mailing Lists / curl-users / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: Making Python Script Exit Completely with One Ctrl+C

From: Dan Fandrich via curl-users <curl-users_at_lists.haxx.se>
Date: Sat, 9 Dec 2023 18:58:25 -0800

On Sat, Dec 09, 2023 at 01:51:13PM +0800, Hongyi Zhao via curl-users wrote:
> Now, I try to compare the manually computed average speed and the one
> given by pycurl in the attached script, but the latter always is 0:
[...]
> try:
> c.perform()
> py_speed = c.getinfo(pycurl.SPEED_DOWNLOAD) / 1024
> except pycurl.error as e:
> pass
> finally:
> c.close()

Are you sure c.perform() isn't raising an exception? That would leave py_speed
as 0, as you are observing. Hiding exceptions like this can cause no end of
problems when things go wrong.
-- 
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-users
Etiquette:   https://curl.se/mail/etiquette.html
Received on 2023-12-10