try: testfile = open("silly") testfile.write(" Silly billy") except IOError: print("File error") else: print("It worked")