import sys
try:
with open(sys.argv[1], "w") as writer:
except Exception as e:
# unknown exception
print("Exception: {}".format(e))
sys.exit()
import sys
try:
with open(sys.argv[1], "w") as writer:
except Exception as e:
# unknown exception
print("Exception: {}".format(e))
sys.exit()
import sys
try:
with open(sys.argv[1], "w") as writer:
writer.write("Hello World")
writer.write("\n")
except Exception as e:
# unknown exception
print("Exception: {}".format(e))
sys.exit()
import sys
try:
with open(sys.argv[1], "w") as writer:
writer.write("Hello World")
writer.write("\n")
except IndexError as e:
# no arguments provided
print("IndexError: {}".format(e))
sys.exit()
except Exception as e:
# unknown exception
print("Exception: {}".format(e))
sys.exit()
import sys
try:
with open(sys.argv[1], "w") as writer:
writer.write("Hello World")
writer.write("\n")
except IndexError as e:
# no arguments provided
print("IndexError: {}".format(e))
sys.exit()
except IOError as e:
# unable to write to the file
print("IOError: {}".format(e))
sys.exit()
except Exception as e:
# unknown exception
print("Exception: {}".format(e))
sys.exit()
import sys
try:
with open(sys.argv[1], "w") as writer:
writer.write("Hello World")
writer.write("\n")
except IndexError as e:
# no arguments provided
print("IndexError: {}".format(e))
sys.exit()
except IOError as e:
# unable to write to the file
print("IOError: {}".format(e))
sys.exit()
except Exception as e:
# unknown exception
print("Exception: {}".format(e))
sys.exit()