import sys  # exit()

filename = input( 'Please enter a filename: ' )
mode = 'w'  # write mode

# Step 1) Open the file
# Step 2) Verify successful file open 
try:
    infoFileObj = open( filename, mode )
except:
    print('ERROR! Unable to open', filename)
    sys.exit()

print('Yeah,', filename, 'open successfully')