Closed gavinhailey-sunriselabs closed 4 years ago
The exception is being thrown by MSProject, so there's not much pywin32 can do other than catch it - there's no evidence of a pywin32 bug here. You might want to see https://github.com/mhammond/pywin32#support for other support options.
Expected behavior: MS Project generates the visual report and opens it in excel. Actual behavior: Exception thrown sometimes, successfully generates in 1 of every 10 tries or so.
Code:
Exception:
Traceback (most recent call last): File "C:/Users/ghailey/python/MicrosoftProjectExport/generate_usage_report.py", line 42, in <module> main('C:\\Users\\ghailey\\Downloads\\AIO200529-pln-v00c Retinopathy imager Phase 0 Plan for proposal.mpp') File "C:/Users/ghailey/python/MicrosoftProjectExport/generate_usage_report.py", line 35, in main project.create_resource_usage_report() File "C:/Users/ghailey/python/MicrosoftProjectExport/generate_usage_report.py", line 27, in create_resource_usage_report self.mpp.VisualReportsEdit(template_path) File "C:\Users\ghailey\AppData\Local\Temp\gen_py\3.8\A7107640-94DF-1068-855E-00DD01075445x0x4x9\_MSProject.py", line 3087, in VisualReportsEdit return self._oleobj_.InvokeTypes(2143, LCID, 1, (11, 0), ((12, 16), (3, 48)),strVisualReportTemplateFile pywintypes.com_error: (-2147352567, 'Exception occurred.', (1004, 'Microsoft Project', 'An unexpected error occurred with the method.', 'C:\\Program Files\\Microsoft Office\\Root\\Office16\\VBAPJ.CHM\x00', 131072, 0), None)
Python: v3.8.3 pywin32: v228