MCPcopy Index your code
hub / github.com/PySimpleGUI/PySimpleGUI / delete_file

Method delete_file

PySimpleGUI/PySimpleGUI.py:22681–22704  ·  view source on GitHub ↗

Deltes the filename and path for your settings file. Either paramter can be optional. If you don't choose a path, one is provided for you that is OS specific Windows path default = users/name/AppData/Local/PySimpleGUI/settings. If you don't choose a filename, your a

(self, filename=None, path=None, report_error=False)

Source from the content-addressed store, hash-verified

22679 return self.dict
22680
22681 def delete_file(self, filename=None, path=None, report_error=False):
22682 """
22683 Deltes the filename and path for your settings file. Either paramter can be optional.
22684 If you don't choose a path, one is provided for you that is OS specific
22685 Windows path default = users/name/AppData/Local/PySimpleGUI/settings.
22686 If you don't choose a filename, your application's filename + '.json' will be used
22687 Also sets your current dictionary to a blank one.
22688
22689 :param filename: The name of the file to use. Can be a full path and filename or just filename
22690 :type filename: (str or None)
22691 :param path: The folder that the settings file will be stored in. Do not include the filename.
22692 :type path: (str or None)
22693 :param report_error: Determines if an error should be shown if a delete error happen (i.e. file isn't present)
22694 :type report_error: (bool)
22695 """
22696
22697 if filename is not None or path is not None or (filename is None and path is None):
22698 self.set_location(filename=filename, path=path)
22699 try:
22700 os.remove(self.full_filename)
22701 except Exception as e:
22702 if report_error:
22703 _error_popup_with_traceback('UserSettings delete_file warning ***', 'Exception trying to perform os.remove', e)
22704 self.dict = {}
22705
22706 def write_new_dictionary(self, settings_dict):
22707 """

Callers 1

Calls 3

set_locationMethod · 0.95
removeMethod · 0.80

Tested by

no test coverage detected