import sys, os from ij.gui import GenericDialog gd = GenericDialog("Warning") gd.enableYesNoCancel() gd.addMessage("Do you really want to reset the pre-existing settings?") gd.showDialog() if gd.wasOKed(): dir_path = os.path.dirname(os.path.realpath("__file__")) ini_path = os.path.join(dir_path, "ini.cfg") print ini_path if os.path.isfile(ini_path): os.remove(ini_path) print "Settings cleared!" else: print "No pre-existing settings found, proceed with the analysis"