'Project Cannot Open the File' When Trying to Open Msproject Mpp File by Using Pywin32

I am using pywin32 to extract data from an MSProject (.mpp) file. Everything had gone well until I installed the Japanese version of MSProject on my PC.

The error message shown as below comes out every time when I tried to open a mpp file by pywin32. Is there any piece of suggestions? Thanks!

I have tried:

  • restarting my PC
  • repairing MS Office in Apps & Features settings
import win32com
try:
  mppFileName="Project.mpp"
  mpp=win32com.client.gencache.EnsureDispatch('MSProject.Application')
  mpp.FileOpen(mppFileName)
except Exception as e:
  print(str(e))

(-2147352567, 'Exception occurred.', (1004, '', 'Project cannot open the file.', 'C:\Program Files\Microsoft Office\Root\Office16\VBAPJ.CHM\x00', 131072, 0), None)

1 Answer

After changing the file address into the Absolute Address, the problem has gone. That is,

import win32com
try:
  mppFileName="C:/Project.mpp"
  ...

Reference: [python-win32] Error when trying to open a Microsoft Project file

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Marcus Vance

Marcus Vance

Cybersecurity & Digital Privacy Researcher

Marcus Vance is a cybersecurity auditor and technology writer dedicated to educating the public about online safety, data privacy regulations, enterprise security, and emerging cyber threats.

Share this article
Twitter Facebook Pinterest