[python-win32] Error when trying to open a Microsoft Project file
Daryl Spitzer
daryl.spitzer at gmail.com
Wed May 30 21:00:06 CEST 2007
D'oh! That's embarrasing.
a.FileOpen( r'C:\test.mpp' )
...works too.
I should have clued in to the double backslashes in the path in the
error. (I guess it goes without saying that I don't use Python on
Windows very often.)
Thanks Tim.
--
Daryl
On 5/30/07, Tim Roberts <timr at probo.com> wrote:
> Daryl Spitzer wrote:
> > I'm trying to open a Microsoft Project file using the following:
> >
> >
> >>>> from win32com.client import Dispatch
> >>>> a=Dispatch("MSProject.Application")
> >>>> a.Visible=1
> >>>> a.FileOpen("C:\test.mpp")
> >>>>
> >
> > ...but I get this error message.
> >
> > Traceback (most recent call last):
> > File "<interactive input>", line 1, in <module>
> > File "<COMObject MSProject.Application>", line 8, in FileOpen
> > com_error: (-2147352567, 'Exception occurred.', (1004, 'Microsoft
> > Office Project', 'Project cannot open the file.', 'C:\\Program
> > Files\\Microsoft Office\\OFFICE11\\VBAPJ.CHM', 131072, 0), None)
> >
> > Project (Standard 2003 SP1) will open C:\test.mpp just fine interactively.
> >
> > Can anyone tell me why I'm getting this error message?
>
> Yes, I can. You are trying to open a file name with a tab character in
> it. That is, your file name is C colon tab E S T dot M P P.
>
> Use
> a.FileOpen( "C:\\test.mpp" )
> or
> a.FileOpen( "C:/test.mpp" )
>
>
> > What is that
> > 'C:\\Program Files\\Microsoft Office\\OFFICE11\\VBAPJ.CHM' file? It
> > doesn't exist in that location, but I found it in C:\Program
> > Files\Microsoft Office\OFFICE11\1033\. I tried copying it to
> > C:\Program Files\Microsoft Office\OFFICE11\ but I get the same error.
> >
>
> That's the online help. Project is just telling you where you could
> look for more information about the error message.
>
> --
> Tim Roberts, timr at probo.com
> Providenza & Boekelheide, Inc.
>
> _______________________________________________
> Python-win32 mailing list
> Python-win32 at python.org
> http://mail.python.org/mailman/listinfo/python-win32
>
More information about the Python-win32
mailing list