Selenium Python error: (5, 'OpenSCManager', 'Access is denied.') when a service is stopped -


in selenium python script in setupclass method have code stops tomcat service. used work fine getting error: error: (5, 'openscmanager', 'access denied.')

error details:

    c:\python27\python.exe "c:\program files (x86)\jetbrains\pycharm community edition 5.0.3\helpers\pycharm\utrunner.py" g:\test_runners\selenium_regression_test_5_1_1\regression_testcase\split_into_parts\regressionproject_testcase_part1.py true testing started @ 09:13 ...  error traceback (most recent call last):   file "g:\test_runners\selenium_regression_test_5_1_1\base\basetestcase.py", line 35, in setupclass     service_info(action_stop, globals.machine, globals.service_tomcat)   file "g:\test_runners\selenium_regression_test_5_1_1\utilities\helpermethods.py", line 136, in service_info     win32serviceutil.stopservice(service, machine)   file "c:\python27\lib\site-packages\win32\lib\win32serviceutil.py", line 409, in stopservice     return controlservice(servicename, win32service.service_control_stop, machine)   file "c:\python27\lib\site-packages\win32\lib\win32serviceutil.py", line 315, in controlservice     hscm = win32service.openscmanager(machine,none,win32service.sc_manager_all_access) error: (5, 'openscmanager', 'access denied.')   process finished exit code 0 

setupclass method:

@classmethod def setupclass(cls):     action_stop = 'stop' # stop service     action_start = 'start' # start service     build_text_file_directory = r"\\storage-1\builds\clearcore\autotest"       # stop tomcat service     service_info(action_stop, globals.machine, globals.service_tomcat) 

def service_info method:

def service_info(action, machine, service): if action == 'stop':     win32serviceutil.stopservice(service, machine)     print '%s stopped successfully' % service elif action == 'start':     win32serviceutil.startservice(service, machine)     print '%s started successfully' % service elif action == 'restart':     win32serviceutil.restartservice(service, machine)     print '%s restarted successfully' % service elif action == 'status':     if win32serviceutil.queryservicestatus(service, machine)[1] == 4:         print "%s running normally" % service     else:         print "%s *not* running" % service 

globals.py:

machine = 'test1' service_tomcat = 'tomcat8' 

how can resolve 'openscmanager', 'access denied.'please? user details have not changed on server.

thanks, riaz


Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -