def Init(): directory = os.path.join(os.path.dirname(__file__), "Settings") if not os.path.exists(directory): os.makedirs(directory) SettingsFile = os.path.join(os.path.dirname(__file__), "Settings\settings.json") ScriptSettings = MySettings(SettingsFile) ScriptSettings.Response = "Overwritten pong! ^_^" return
def Init(): # Create Settings Directory directory = os.path.join(os.path.dirname(__file__), "Settings") if not os.path.exists(directory): os.makedirs(directory) # Load settings SettingsFile = os.path.join(os.path.dirname(__file__), "settings.json") ScriptSettings = MySettings(SettingsFile) ScriptSettings.Response = "Settings Overwritten" return
def Init(): # Create Settings Directory directory = os.path.join(os.path.dirname(__file__), "Settings") if not os.path.exists(directory): os.makedirs(directory) # Checks if beerfile exists, if it doesnt: creates it if os.path.isfile(beerFilepath) == 0: data = {} with open(beerFilepath, 'w') as f: json.dump(data, f, indent=4) # Load settings SettingsFile = os.path.join("Settings", "settings.json") SettingsPath = os.path.join(os.path.dirname(__file__), SettingsFile) ScriptSettings = MySettings(SettingsPath) ScriptSettings.Response = "Overwritten file!" return
def Init(): try: Log('Settings start off as:' + json.dumps(ScriptSettings.__dict__)) except: Log('settings not defined yet') directory = os.path.join(os.path.dirname(__file__), "Settings") Log('Checking settings directory for ' + ScriptName + ' exists? ' + directory) if not os.path.exists(directory): Log('directory does not exist, creating settings directory') os.makedirs(directory) # Load settings SettingsFile = os.path.join(os.path.dirname(__file__), "Settings\settings.json") Log('Loading settings for ' + ScriptName + ' found at: ' + SettingsFile) ScriptSettings = MySettings(SettingsFile) ScriptSettings.Response = "Overwritten pong! ^_^" Log('Settings are now:' + json.dumps(ScriptSettings.__dict__)) return