Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python write error to file

logf = open("download.log", "w")
for download in download_list:
    try:
        # code to process download here
    except Exception as e:     # most generic exception you can catch
        logf.write("Failed to download {0}: {1}
".format(str(download), str(e)))
        # optional: delete local version of failed download
    finally:
        # optional clean up code
        pass
Comment

PREVIOUS NEXT
Code Example
Python :: how to get spotify playlist id in spotipy 
Python :: open chrome console in selenium 
Python :: what is manage.py 
Python :: flatten dict with lists as entries 
Python :: python sort case insensitive 
Python :: opencv rgb to gray custom 
Python :: how to add items in list in python at specific position 
Python :: extract text from image python without tesseract 
Python :: example exponential distribution python 
Python :: put grid behind matplotlib 
Python :: python find image on screen 
Python :: python 3.4 release date 
Python :: how to access dictionary inside an array python 
Python :: print("Hello world!") 
Python :: scipy cdf example 
Python :: pandas dataframe total column 
Python :: how to remove last element from a list python 
Python :: Get git sha 
Python :: forward checking algorithm python 
Python :: slug 
Python :: load text file line in listbox python tkinter site:stackoverflow.com 
Python :: linux pyspark select java version 
Python :: rabin karp algorithm 
Shell :: remove steam from ubuntu 
Shell :: git store credential 
Shell :: grep ip address 
Shell :: check gnome version ubuntu terminal 
Shell :: chrome update ubuntu 20.04 
Shell :: remote origin already exists 
Shell :: how to uninstall thunderbird ubuntu terminal 
ADD CONTENT
Topic
Content
Source link
Name
4+4 =