wkentaro / gdown

Google Drive Public File Downloader when Curl/Wget Fails
MIT License
4.29k stars 350 forks source link

How to catch error when download a file error? #88

Closed quangtuyennguyen closed 3 years ago

quangtuyennguyen commented 3 years ago

I downloading some files from google drive, Sometimes occur errors like "Access denied, Too many users have viewed or downloaded this file recently...", so I want get file error. I tried this code below, but not working. Can someone help me? try: ... gdown.download(url, output, quiet=False)

except Exception as e: logger.error('Failed to upload to ftp: '+ str(e)) # Error does not appear here!

wkentaro commented 3 years ago

You can check it by the returned variable by gdown.download

filename = gdown.download(...)
if filename is None:
    logger.error("Faield to download file")
karchern commented 9 months ago

Is this still the preferred way to do it? Some of your more recent commits suggest exception handling is properly implemented now but can't find more info about it