def CheckOutputFile(filename):
 full_path = os.path.abspath(filename)
 if os.path.exists(full_path):
  raise FileExistsError(('%s: output file exists' % filename))
 elif (not os.access(os.path.dirname(full_path), os.W_OK)):
  raise FileNotWritableError(('%s: not writable' % os.path.dirname(full_path)))

def CheckOutputFile ( filename ) : full_path = os . path . abspath ( filename ) if os . path . exists ( full_path ) : raise FileExistsError ( ( '%s: output file exists' % filename ) ) elif ( not os . access ( os . path . dirname ( full_path ) , os . W_OK ) ) : raise FileNotWritableError ( ( '%s: not writable' % os . path . dirname ( full_path ) ) )
check that the given file does not exist and can be opened for writing .