'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...
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