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

Dan Fandrich via curl-users <[email protected]>
Newsgroups gmane.comp.web.curl.general
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.