We have a command job that calls a batch file that runs a Python script to modify an Excel spreadsheet using Excel.
When we run the batch file manually as the job owner on the system it works fine.
When we run the same through as 12.x agent the agent fails with an error message:
.968-0500 CAWA_I_20018 Job failed. Exit code 1, Status: "Incorrect function."
The standard error file from the job shows the following:
Traceback (most recent call last):
File "<drive>:\<folder1>\<folder2>\test.py", line 8, in <module>
wb = excel.Workbooks.Open(excel_file_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<COMObject <unknown>>", line 5, in Open
pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, 'Microsoft Excel', "Microsoft Excel cannot access the file '<drive>:\<folder1>\<folder2>\\test.xlsx'.
There are several possible reasons:\n\n•
The file name or path does not exist.\n•
The file is being used by another program.\n•
The workbook you are trying to save has the same name as a currently open workbook.", 'xlmain11.chm', 0, -2146827284), None)
Traceback (most recent call last):
File "<drive>:\<folder1>\<folder2>\test.py", line 8, in <module>
wb = excel.Workbooks.Open(excel_file_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<COMObject <unknown>>", line 5, in Open
pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, 'Microsoft Excel', "Microsoft Excel cannot access the file '<drive>:\<folder1>\<folder2>\\test.xlsx'.
There are several possible reasons:\n\n•
The file name or path does not exist.\n•
The file is being used by another program.\n•
The workbook you are trying to save has the same name as a currently open workbook.", 'xlmain11.chm', 0, -2146827284), None)
Windows 2016 server
Autosys Agent 12.x
the default for the agent is to use a 32-bit command processor.
This was to maintain backward compatibility with 11.x agents
this is controlled by setting the oscomponent.cmdprefix.force to TRUE in the agentparm.txt
changed the following parameter in the agentparm.txt:
From:
oscomponent.cmdprefix.force=true
to:
oscomponent.cmdprefix.force=false
and restarted the agent to correct this error.
one way to test this outside the application would be to open a 32-bit Command prompt and then run start the batch file from there and see if you have the same issue.