Error: pywintypes.com_error: (-2147024891, 'Access is denied.', None, None)
Note that issues in this repository are only for bugs or feature requests in the pywin32.
If you need support or help using this package, please follow these instructions - support or help requests will be closed without comment.
For all bugs, please provide the following information.
- Expected behavior and actual behavior. Expected to run the VB Macros from xlsm file Error: File "D:\Program Files\Python37\lib\site-packages\win32com\client\dynamic.py", line 89, in _GetGoodDispatch IDispatch = pythoncom.connect(IDispatch) pywintypes.com_error: (-2147221021, 'Operation unavailable', None, None)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "W:\WAY4DTNA\Jenkins_2_391_1_Repository\SAP20163\workspace\Uma_Test_RF_WAY4Runner_TestCase\exec_3\svn\automation\automation\V2\RobotFramework/Testcases\runtdsgen.py", line 51, in
- Steps to reproduce the problem. Run the program from Jenkins, If it from manual local machine it is working fine
def runmacro(): workbook = load_workbook(PATH_IN_XLS + "/" + TRANSACTIONS_SPECS, keep_vba=True) #Sheet name from the specification to be accessed sheet = workbook["Trx_Specs_Sheet"] #Details are filling into excel sheet['E2'] = TRANS_DATE sheet['E3'] = SEQ_NUM sheet['E5'] = RUN_NUM sheet['G3'] = PATH_RESULT #This part fills in excel to inform the TDS UFX files are geenrating from Automation not Manual sheet['G2'] = 'A' #The SENDER will be passed into excel sheet['G5'] = SENDER workbook.save(PATH_IN_XLS + "/" + TRANSACTIONS_SPECS)
#Below functionality helps to trigger the VB Macro which is in .xlsm file
xl=win32com.client.Dispatch("Excel.Application")
xl.Workbooks.Open(os.path.abspath(PATH_IN_XLS + "/" + TRANSACTIONS_SPECS))
xl.Application.Run(TRANSACTIONS_SPECS + mymacro)
xl.Application.Quit()
del xl
runmacro()
- Version of Python and pywin32 Don't have full idea
This is going to be something related to the Jenkins environment - possibly that Excel is installed under a different user than the script is being run uder.
Thank you for response, yeah you are correct , it is running find under my user id in local machine, When I run from the jenkins it is using different user and the same user has full permission as like my user id.
Not much we can do here.
Hi @umamahesh0123, I am facing same error while trying to access Omicron. I have configured windows self-hosted runner and running automation testing code for web application developed via Selenium. If you have fix around it could please share the details for the same. That would be great help. Thanks.