2. Raising an Exception¶

2.1. Catching the Exception¶

2.2. Handling Exceptions¶
def save_data():
try:
fileD = open("orders.txt","a")
fileD.write("Destination:\n")
fileD.write("%s\n" %destination.get())
fileD.write("Description:\n")
fileD.write("%s\n" %description.get())
fileD.write("Speech:\n")
fileD.write("%s\n" %Speech.get("1.0",END))
destination.set(None)
description.delete(0,END)
address.delete("1.0",END)
except Exception as exception:
app.title('Recording file %s' %exception)
Note: to test the exception you will need to change the properties of the file

You have attempted of activities on this page