[英]'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. 我正在使用pywin32从MSProject(.mpp)文件中提取数据。 Everything had gone well until I installed the Japanese version of MSProject on my PC.
一切顺利,直到我在PC上安装了日语版的MSProject。
The error message shown as below comes out every time when I tried to open a mpp file by pywin32. 每当我尝试通过pywin32打开mpp文件时,都会出现如下所示的错误消息。 Is there any piece of suggestions?
有什么建议吗? Thanks!
谢谢!
I have tried: 我努力了:
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) (-2147352567,'发生异常。',(1004,'','项目无法打开文件。','C:\\ Program Files \\ Microsoft Office \\ Root \\ Office16 \\ VBAPJ.CHM \\ x00',131072,0) , 没有)
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 参考: [python-win32]尝试打开Microsoft Project文件时出错
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.