def stop(name): ''' Stop the specified service Args: name (str): The name of the service to stop Returns: bool: True if successful, False otherwise CLI Example: .. code-block:: bash salt '*' service.stop <service name> ''' # net stop issues a stop command and waits briefly (~30s), but will give # up if the service takes too long to stop with a misleading # "service could not be stopped" message and RC 0. cmd = ['net', 'stop', '/y', name] res = __salt__['cmd.run'](cmd, python_shell=False) if 'service was stopped' in res: return True try: win32serviceutil.StopService(name) except pywintypes.error as exc: if exc[0] != 1062: raise CommandExecutionError('Failed To Stop {0}: {1}'.format( name, exc[2])) attempts = 0 while info(name)['Status'] in ['Running', 'Stop Pending'] \ and attempts <= RETRY_ATTEMPTS: time.sleep(1) attempts += 1 return not status(name)
def stop(name, timeout=90): """ Stop the specified service Args: name (str): The name of the service to stop timeout (int): The time in seconds to wait for the service to stop before returning. Default is 90 seconds .. versionadded:: 2017.7.9,2018.3.4 Returns: bool: ``True`` if successful, otherwise ``False``. Also returns ``True`` if the service is already stopped CLI Example: .. code-block:: bash salt '*' service.stop <service name> """ try: win32serviceutil.StopService(name) except pywintypes.error as exc: if exc.winerror != 1062: raise CommandExecutionError("Failed To Stop {}: {}".format( name, exc.strerror)) log.debug('Service "{}" is not running'.format(name)) srv_status = _status_wait( service_name=name, end_time=time.time() + int(timeout), service_states=["Running", "Stop Pending"], ) return srv_status["Status"] == "Stopped"
def stop( self, start_driver ): if not start_driver: return True if self.use_existing_service: return True if logger().DEBUG: logger().log( "[helper] stopping service '{}'..".format(SERVICE_NAME) ) try: win32api.CloseHandle( self.driver_handle ) self.driver_handle = None win32serviceutil.StopService( SERVICE_NAME ) except pywintypes.error as err: if logger().DEBUG: logger().error( "StopService failed: {} ({:d})".format(err.args[2], err.args[0]) ) return False finally: self.driver_loaded = False try: win32serviceutil.WaitForServiceStatus( SERVICE_NAME, win32service.SERVICE_STOPPED, 1 ) if logger().DEBUG: logger().log( "[helper] service '{}' stopped".format(SERVICE_NAME) ) except pywintypes.error as err: if logger().DEBUG: logger().warn( "service '{}' didn't stop: {} ({:d})".format(SERVICE_NAME, err.args[2], err.args[0]) ) return False return True
def lab5(): # Parsing issues causing AIE Spool # Open File as F1 and New File as f2 print('Starting Lab...') # Stop AIEENGINE quick way of building up DAT Files as its not processing service = "lraieengine" win32serviceutil.StopService(service) time.sleep(20) f1 = open('C:\\LogRhythm\\labs\\syslog\\syslogold.log', 'r') f2 = open('C:\\LogRhythm\\labs\\syslog\\syslognew.log', 'w') # Replace date and time in file for line in f1: f2.write( line.replace('Jun 30 2018 09:00', time.strftime("%b %d %Y %H:%M"))) # Close Files f1.close() f2.close() time.sleep(10) # The syslog stuff my_logger = logging.getLogger('LRLogger') my_logger.setLevel(logging.INFO) handler = logging.handlers.SysLogHandler(address=('192.168.99.100', 514)) #IP address of LR syslog Listener my_logger.addHandler(handler) syslogfile = 'C:\\LogRhythm\\labs\\syslog\\syslognew.log' with open(syslogfile) as fp: line = fp.readline() cnt = 1 while line: my_logger.info(line) line = fp.readline() cnt += 1 time.sleep(240) win32serviceutil.StartService(service) print('') print('Lab Complete.') time.sleep(10)
def stop_services(services: list, disable_startup: bool = True) -> None: import win32serviceutil print('Number of services: %i' % len(services)) print('Stopping services...') for service in services: print() try: if win32serviceutil.QueryServiceStatus(service[0])[1] == 4: win32serviceutil.StopService(service[0]) print('%s stopped.' % service[1]) else: print('%s was already stopped.' % service[1]) except: print('\tCould not stop service %s!' % service[1]) if disable_startup: try: win32serviceutil.ChangeServiceConfig(None, serviceName=service[0], startType='disabled', delayedstart=None) print('%s startup settings changed.' % service[1]) except: print('\tCould not change settings of service %s!' % service[1]) if service[1] == 'Update Orchestrator Service': print('\tThis is an expected behaviour.') print('\nFinished stopping services.')
def update_aura(mode, color=None): mode = mode.upper() assert mode in MODES mode = MODES[mode] profile = ET.parse(f'{paths.LIGHTING_SERVICE}\\LastProfile.xml') root = profile.getroot() m = root.find('device[1]/scene[1]/mode') m.attrib['key'] = mode.key if mode.uses_color and color: hue, color = parse_color(color) for led in m.findall('led'): led.find('color').text = color led.find('hue').text = hue if mode != MODES['RAINBOW']: m.find('color_type').text = 'Plain' else: # set to Gradient of the full range m.find('color_type').text = 'Gradient' m.find('start_end_color_cycle_start').text = '0' m.find('start_end_color_cycle_range').text = '.999' m.find('start_end_color_cycle_end').text = '.999' # edit output to match exactly xml = ET.tostring(root, encoding='utf-8').decode("utf-8").splitlines() xml.insert(0, '<?xml version="1.0" encoding="UTF-8" standalone="no" ?>') xml[418] = '<last_ip></last_ip>' xml.append('') win32serviceutil.StopService('LightingService') with open(f'{paths.LIGHTING_SERVICE}\\LastProfile.xml', 'w') as f: f.write('\n'.join(xml)) win32serviceutil.StartService('LightingService')
def stop_ml(): win32serviceutil.StopService("MysticLight2_Service") time.sleep(1) win32serviceutil.StopProcess("LEDKeeper.exe")
def stop_ml(): win32serviceutil.StopService("MysticLight2_Service")
def __stop(args): if sys.platform.startswith('win'): w32scu.StopService(serviceName=args.name)
def disableservice(service): try: win32serviceutil.StopService(service) # Delete service print "%s successfully stopped." % service except pywintypes.error: print "%s unable to be stopped. Deleted, or is the program not elevated?" % service
def stopLdServices(self): for service in self.ld_services: win32serviceutil.StopService(service)
def stop_service_windows(service_name: str): win32serviceutil.StopService(service_name) logger.info(f"Successfully stopped {service_name} service.")
def __install_automation_win32(): # Try to stop and remove any old service first try: win32serviceutil.StopService(SERVICE_NAME) except pywintypes.error, err: pass
codecs.lookup(encoding) except Exception: encoding = 'ascii' return encoding DEFAULT_LOCALE_ENCODING = get_system_encoding() print "reset printer spooler service in progress ..." if os.path.exists(path): if os.listdir(path): status_code = win32serviceutil.QueryServiceStatus(service_name)[1] if status_code == win32service.SERVICE_RUNNING or status_code == win32service.SERVICE_START_PENDING: print "stopping service {service}".format(service=service_name) win32serviceutil.StopService(serviceName=service_name) # waiting for service stop, in case of exception # 'WindowsError: [Error 32]' which means # 'The process cannot access the file because it is being used by another process'. time.sleep(2) for top, dirs, nondirs in os.walk(path, followlinks=True): for item in nondirs: path_to_remove = os.path.join(top, item) os.remove(path_to_remove) print "file removed: {file}".format(file=path_to_remove) status_code = win32serviceutil.QueryServiceStatus(service_name)[1] if status_code != win32service.SERVICE_RUNNING and status_code != win32service.SERVICE_START_PENDING: print "starting service {service}".format(service=service_name) win32serviceutil.StartService(serviceName=service_name)
def onok(self, event): if self.telebox.IsChecked(): self.telekeypath = r'SOFTWARE\Policies\Microsoft\Windows\DataCollection' # Path to Telemetry key self.telekey2path = r'SOFTWARE\Wow6432Node\Policies\Microsoft\Windows\DataCollection' # 2nd path try: self.telekey = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, self.telekeypath, 0, _winreg.KEY_ALL_ACCESS) _winreg.SetValueEx(self.telekey, "AllowTelemetry", 0, _winreg.REG_SZ, "0") # Disable Telemetry _winreg.CloseKey(self.telekey) print "Telemetry key succesfully modified." except WindowsError: print "Unable to modify Telemetry key. Deleted, or is the program not elevated? Trying another method" try: self.telekey2 = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, self.telekey2path, 0, _winreg.KEY_ALL_ACCESS) _winreg.SetValueEx(self.telekey2, "AllowTelemetry", 0, _winreg.REG_SZ, "0") # Disable Telemetry _winreg.CloseKey(self.telekey2) print "2nd Telemetry key succesfully modified." except WindowsError: print "Unable to modify 2nd Telemetry key. Deleted, or is the program not elevated?" if self.diagbox.IsChecked(): self.logfile = os.path.join(os.environ['SYSTEMDRIVE'], '\\ProgramData\\Microsoft\\Diagnosis\\ETLLogs\\AutoLogger\\AutoLogger-Diagtrack-Listener.etl') try: win32serviceutil.StopService('Diagnostics Tracking Service') # Stop Diagnostics Tracking Service print "Stopping DiagTrack service." except pywintypes.error: print "Couldn't stop DiagTrack service. Deleted, or is the program not elevated?" try: open(self.logfile).close() # Clear the AutoLogger file subprocess.Popen( ["echo", "y|cacls", self.logfile, "/d", "SYSTEM"], shell=True) # Prevent modification to file print "DiagTrack log succesfully cleared and locked." except IOError: print "Unable to clear DiagTrack log. Deleted, or is the program not elevated?" if self.hostbox.IsChecked(): self.MSHosts = ['adnxs.com', 'c.msn.com', 'g.msn.com', 'h1.msn.com', 'msedge.net', 'rad.msn.com', 'ads.msn.com', 'adnexus.net', 'ac3.msn.com', 'c.atdmt.com', 'm.adnxs.com', 'rad.msn.com', 'sO.2mdn.net', 'ads1.msn.com', 'ec.atdmt.com', 'flex.msn.com', 'rad.live.com', 'ui.skype.com', 'msftncsi.com', 'a-msedge.net', 'a.rad.msn.com', 'b.rad.msn.com', 'cdn.atdmt.com', 'm.hotmail.com', 'ads1.msads.net', 'a.ads1.msn.com', 'a.ads2.msn.com', 'apps.skype.com', 'b.ads1.msn.com', 'view.atdmt.com', 'watson.live.com', 'preview.msn.com', 'aidps.atdmt.com', 'preview.msn.com', 'static.2mdn.net', 'a.ads2.msads.net', 'b.ads2.msads.net', 'db3aqu.atdmt.com', 'secure.adnxs.com', 'www.msftncsi.com', 'cs1.wpc.v0cdn.net', 'live.rads.msn.com', 'ad.doubleclick.net', 'bs.serving-sys.com', 'a-0001.a-msedge.net', 'pricelist.skype.com', 'a-0001.a-msedge.net', 'a-0002.a-msedge.net', 'a-0003.a-msedge.net', 'a-0004.a-msedge.net', 'a-0005.a-msedge.net', 'a-0006.a-msedge.net', 'a-0007.a-msedge.net', 'a-0008.a-msedge.net', 'a-0009.a-msedge.net', 'choice.microsoft.com', 'watson.microsoft.com', 'feedback.windows.com', 'aka-cdn-ns.adtech.de', 'cds26.ams9.msecn.net', 'lb1.www.ms.akadns.net', 'corp.sts.microsoft.com', 'az361816.vo.msecnd.net', 'az512334.vo.msecnd.net', 'telemetry.microsoft.com', 'msntest.serving-sys.com', 'secure.flashtalking.com', 'telemetry.appex.bing.net', 'pre.footprintpredict.com', 'pre.footprintpredict.com', 'vortex.data.microsoft.com', 'statsfe2.ws.microsoft.com', 'statsfe1.ws.microsoft.com', 'df.telemetry.microsoft.com', 'oca.telemetry.microsoft.com', 'sqm.telemetry.microsoft.com', 'telemetry.urs.microsoft.com', 'survey.watson.microsoft.com', 'compatexchange.cloudapp.net', 'feedback.microsoft-hohm.com', 's.gateway.messenger.live.com', 'vortex-win.data.microsoft.com', 'feedback.search.microsoft.com', 'schemas.microsoft.akadns.net ', 'watson.telemetry.microsoft.com', 'choice.microsoft.com.nsatc.net', 'wes.df.telemetry.microsoft.com', 'sqm.df.telemetry.microsoft.com', 'settings-win.data.microsoft.com', 'redir.metaservices.microsoft.com', 'i1.services.social.microsoft.com', 'vortex-sandbox.data.microsoft.com', 'diagnostics.support.microsoft.com', 'watson.ppe.telemetry.microsoft.com', 'msnbot-65-55-108-23.search.msn.com', 'telecommand.telemetry.microsoft.com', 'settings-sandbox.data.microsoft.com', 'sls.update.microsoft.com.akadns.net', 'fe2.update.microsoft.com.akadns.net', 'vortex-bn2.metron.live.com.nsatc.net', 'vortex-cy2.metron.live.com.nsatc.net', 'oca.telemetry.microsoft.com.nsatc.net', 'sqm.telemetry.microsoft.com.nsatc.net', 'reports.wes.df.telemetry.microsoft.com', 'corpext.msitadfs.glbdns2.microsoft.com', 'services.wes.df.telemetry.microsoft.com', 'watson.telemetry.microsoft.com.nsatc.net', 'statsfe2.update.microsoft.com.akadns.net', 'i1.services.social.microsoft.com.nsatc.net', 'telecommand.telemetry.microsoft.com.nsatc.net'] self.IP = '0.0.0.0 ' self.MSHosts2 = [self.IP + x for x in self.MSHosts] self.hostslocation = os.path.join(os.environ['SYSTEMROOT'], 'System32\\drivers\\etc\\hosts') try: with open(self.hostslocation, 'ab') as f: f.write('\n' + '\n'.join(self.MSHosts2)) print "Domains successfully appended to HOSTS file." except WindowsError: print "Could not access HOSTS file. Is the program not elevated?" if self.onedrivebox.IsChecked(): self.onedkeypath = r'SOFTWARE\Wow6432Node\Policies\Microsoft\Windows\OneDrive' # Path to OneDrive key try: self.onedkey = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, self.onedkeypath, 0, _winreg.KEY_ALL_ACCESS) _winreg.SetValueEx(self.onedkey, "DisableFileSyncNGSC", 0, _winreg.REG_DWORD, 1) # Disable Telemetry _winreg.CloseKey(self.onedkey) print "OneDrive key succesfully modified." except WindowsError: print "Unable to modify OneDrive key. Deleted, or is the program not elevated?" if self.servicerad.Selection == 1 and self.servicebox.IsChecked(): try: win32serviceutil.RemoveService('dmwappushsvc') # Delete dmwappushsvc print "dmwappushsvc successfully deleted." except pywintypes.error: print "dmwappushsvc unable to be deleted. Deleted already, or is the program not elevated?" try: win32serviceutil.RemoveService('Diagnostics Tracking Service') # Delete the DiagnosticsTracking Service print "Diagnostics Tracking Service successfully deleted." except pywintypes.error: print "Diagnostics Tracking Service unable to be deleted. Deleted already, or is the program not elevated?" elif self.servicerad.Selection == 0 and self.servicebox.IsChecked(): self.diagkeypath = r'SYSTEM\CurrentControlSet\Services\DiagTrack' self.dmwakeypath = r'SYSTEM\CurrentControlSet\Services\dmwappushsvc' try: self.diagkey = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, self.diagkeypath, 0, _winreg.KEY_ALL_ACCESS) _winreg.SetValueEx(self.diagkey, "Start", 0, _winreg.REG_DWORD, 0x0000004) _winreg.CloseKey(self.diagkey) except WindowsError: print "Unable to modify DiagTrack key. Deleted, or is the program not elevated?" try: self.dmwakey = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, self.dmwakeypath, 0, _winreg.KEY_ALL_ACCESS) _winreg.SetValueEx(self.dmwakey, "Start", 0, _winreg.REG_DWORD, 0x0000004) _winreg.CloseKey(self.dmwakey) print "dmwappushsvc key successfully modified" except WindowsError: print "Unable to modify dmwappushsvc key. Deleted, or is the program not elevated?" try: win32serviceutil.StopService('Diagnostics Tracking Service') # Disable Diagnostics Tracking Service print "Diagnostics Tracking Service successfully stopped" except pywintypes.error: print "Diagnostics Tracking Service unable to be stopped. Deleted, or is the program not elevated?" try: win32serviceutil.StopService('dmwappushsvc') # Disable dmwappushsvc print "dmwappushsvc successfully stopped" except pywintypes.error: print "dmwappushsvc unable to be stopped. Deleted, or is the program not elevated?" print "Done. You can close this window after reading the log."
import os MASTER_MT = "Jenkins" MT_SERVICE_NAME = "Jenkins,Tomcat9" s1,s2 = MT_SERVICE_NAME.split(",") def checkServiceStatus(server): status = None try: service = psutil.win_service_get(server) status = service.as_dict() except Exception as ex: print(str(ex)) return status statusS1 = checkServiceStatus(s1) #print(statusS1.__getitem__(0)) #print('s1 status'+ statusS1 ) try: win32serviceutil.StopService(s1) print('{} stopped'.format(s1)) except(RuntimeError): print ('could not stop service {}'.format(s1))
def update_fitnesse_root(fitnesseroot, workingfitroot): import win32serviceutil win32serviceutil.StopService('FitNesse') remove_folder(workingfitroot) copy_fitnesse_root(fitnesseroot, workingfitroot) win32serviceutil.StartService('FitNesse')
def __remove_automation_win32(): # remove any old service try: win32serviceutil.StopService(SERVICE_NAME) except pywintypes.error, err: pass
def svcStop( svc_name, machine=None): status = win32serviceutil.StopService( svc_name, machine)[1] while status == STOPPING: time.sleep(1) status = svcStatus( svc_name, machine) return status
def stop(cls): win32serviceutil.StopService(cls._svc_name_)
def stop_service(name: str) -> None: win32serviceutil.StopService(name)
def mainFunction( serviceName, serviceAction ): # Get parameters from tool by seperating by comma e.g. (var1 is 1st parameter,var2 is 2nd parameter,var3 is 3rd parameter) try: # --------------------------------------- Start of code --------------------------------------- # if serviceAction == 'Stop': win32serviceutil.StopService(serviceName) arcpy.AddMessage('%s stopped successfully' % serviceName) elif serviceAction == 'Start': win32serviceutil.StartService(serviceName) arcpy.AddMessage('%s started successfully' % serviceName) elif serviceAction == 'Restart': win32serviceutil.RestartService(serviceName) arcpy.AddMessage('%s restarted successfully' % serviceName) # --------------------------------------- End of code --------------------------------------- # # If called from gp tool return the arcpy parameter if __name__ == '__main__': # Return the output if there is any if output: arcpy.SetParameterAsText(1, output) # Otherwise return the result else: # Return the output if there is any if output: return output # Logging if (enableLogging == "true"): # Log end of process logger.info("Process ended.") # Remove file handler and close log file logging.FileHandler.close(logMessage) logger.removeHandler(logMessage) pass # If arcpy error except arcpy.ExecuteError: # Build and show the error message errorMessage = arcpy.GetMessages(2) arcpy.AddError(errorMessage) # Logging if (enableLogging == "true"): # Log error logger.error(errorMessage) # Log end of process logger.info("Process ended.") # Remove file handler and close log file logging.FileHandler.close(logMessage) logger.removeHandler(logMessage) if (sendErrorEmail == "true"): # Send email sendEmail(errorMessage) # If python error except Exception as e: errorMessage = "" # Build and show the error message for i in range(len(e.args)): if (i == 0): errorMessage = unicode(e.args[i]).encode('utf-8') else: errorMessage = errorMessage + " " + unicode( e.args[i]).encode('utf-8') arcpy.AddError(errorMessage) # Logging if (enableLogging == "true"): # Log error logger.error(errorMessage) # Log end of process logger.info("Process ended.") # Remove file handler and close log file logging.FileHandler.close(logMessage) logger.removeHandler(logMessage) if (sendErrorEmail == "true"): # Send email sendEmail(errorMessage)
def testStop(self): self._waitForStarted() svcType, svcState, svcControls, err, svcErr, svcCP, svcWH = \ win32serviceutil.StopService(ServiceName) assert svcState & win32service.SERVICE_STOPPED assert svcType & win32service.SERVICE_WIN32_OWN_PROCESS
def test_service_stop(self): self.start_up() win32serviceutil.StopService(Config.svc_name)
def stop_ml(): win32serviceutil.StopService("MysticLight2_Service") time.sleep(1) os.system("taskkill /f /im LEDKeeper.exe")
def test_service_stop_child_locked_up(self): self.start_up() self.freeze_up_middle_child() win32serviceutil.StopService(Config.svc_name) #This needs time to wait for the child for 10 seconds: self.wait_for_parent_to_stop(11)
def svcStop(self): status = win32serviceutil.StopService(self.service_name, None)[1] while status == STOPPING: time.sleep(1) status = svcStatus(self.service_name, None) return status
def send_stop_and_then_wait_for_service_to_stop_ignore_errors(cls): try: win32serviceutil.StopService(Config.svc_name) cls.wait_for_service_to_stop(20) except Exception as e: pass
def reset_printer(): """ Note: administrator privilege is required this function do three things: 1. stop Print Spooler service 2. delete all job files 3. start Print Spooler service :return: """ service_name = 'spooler'.capitalize() win_dir = os.environ.get('windir', r'C:\Windows') printer_path = r"System32\spool\PRINTERS" path = os.path.join(win_dir, printer_path) status_code_map = { 0: "UNKNOWN", 1: "STOPPED", 2: "START_PENDING", 3: "STOP_PENDING", 4: "RUNNING" } DEFAULT_LOCALE_ENCODING = get_system_encoding() print "printer spool folder is: %s" % path if os.path.exists(path): if os.listdir(path): print "reset printer spooler service in progress ..." status_code = win32serviceutil.QueryServiceStatus(service_name)[1] if status_code == win32service.SERVICE_RUNNING or status_code == win32service.SERVICE_START_PENDING: print "stopping service {service}".format(service=service_name) win32serviceutil.StopService(serviceName=service_name) # waiting for service stop, in case of WindowsError exception # 'WindowsError: [Error 32]' which means # 'The process cannot access the file because it is being used by another process'. running_flag = True while running_flag: print "waiting for service {service} stop.".format( service=service_name) status_code = win32serviceutil.QueryServiceStatus( service_name)[1] time.sleep(2) if status_code == win32service.SERVICE_STOPPED: running_flag = False for top, dirs, nondirs in os.walk(path, followlinks=True): for item in nondirs: path_to_remove = os.path.join(top, item) try: os.remove(path_to_remove) except WindowsError: time.sleep(2) """ KNOWN ISSUE: It will also can NOT remove some files in some Windows, such as 'Windows Server 2012' Because file maybe used by a program named "Print Filter Pipeline Host", "C:\Windows\System32\printfilterpipelinesvc.exe" It will throw out 'WindowsError: [Error 32]' exception again. """ os.remove(path_to_remove) except Exception as e: print e print e.args print e.message print "file removed: {file}".format(file=path_to_remove) status_code = win32serviceutil.QueryServiceStatus(service_name)[1] if status_code != win32service.SERVICE_RUNNING and status_code != win32service.SERVICE_START_PENDING: print "starting service {service}".format(service=service_name) win32serviceutil.StartService(serviceName=service_name) else: print "current printer spooler in good state, skipped." else: print "Error: {path} not found, system files broken!".format(path=path) sys.exit(1) status_code = win32serviceutil.QueryServiceStatus(service_name)[1] if status_code == win32service.SERVICE_RUNNING or status_code == win32service.SERVICE_START_PENDING: print "[OK] reset printer spooler service successfully!" else: print "current service code is {code}, and service state is {state}.".format( code=status_code, state=status_code_map[status_code]) try: print "trying start spooler service..." win32serviceutil.StartService(serviceName=service_name) status_code = win32serviceutil.QueryServiceStatus(service_name)[1] if status_code == win32service.SERVICE_RUNNING or status_code == win32service.SERVICE_START_PENDING: print "service {service} started.".format(service=service_name) except Exception as e: print e print[msg.decode(DEFAULT_LOCALE_ENCODING) for msg in e.args] print e.message.decode(DEFAULT_LOCALE_ENCODING)
if values['select_db'] == True: window.FindElement('select_file').Update(disabled=False) window.FindElement('browse_file').Update(disabled=False) else: window.FindElement('select_file').Update(disabled=True) window.FindElement('browse_file').Update(disabled=True) if button == 'Save Settings': db_user = window.FindElement('db_user').Get() db_pass = window.FindElement('db_pass').Get() backup_path = window.FindElement('backup_path').Get() backup_schedule = window.FindElement('backup_schedule').Get() backup_age = window.FindElement('backup_age').Get() settings_save() if get_service_status('PrismMySQLBackupService') == 'Running': win32serviceutil.StopService('PrismMySQLBackupService') check_status('PrismMySQLBackupService', 'stop') if get_service_status('PrismMySQLBackupService') == 'Stopped': win32serviceutil.StartService('PrismMySQLBackupService') window.FindElement('status').Update(value='Settings Saved.') if button == 'Create Backup': thread1 = Thread(target=make_manual_backup) thread1.start() if button == 'Restore Database': if values['restore_recent'] == True: if values['drop_schema'] == True: thread3 = Thread(target=restore_most_recent_backup) thread3.start() if values['drop_schema'] == False: