[python-win32] MSProject and export maps

Ron Henderson Ron.Henderson at dreamworks.com
Wed May 28 22:49:43 CEST 2008


Tim Golden wrote:

> Ron Henderson wrote:
>
>> Thanks so much for trying this out. You've verified that it's 
>> possible to get this working.
>>
>> However, when I execute the same code, the file "p2.csv" is exactly 
>> same size as p1.mpp and contains binary data, not the text. Since you 
>> have it working it must be a bug in either my version of MSProject or 
>> win32com. I'm using:
>
We're using identical versions of Python and win32com

> (BTW Office Project Standard 2003 11.0.2003.0816.15)

I'm using a slightly different (but nominally more recent) version of 
Project:

Office Project Professional 2003 (11.3.2007.1529.15) SP3

> Also, and please don't take this the wrong way, could you post
> a screen dump of your interpreter window, showing the (equivalent)
> code *and the output file*.

Absolutely. This has got to be either something silly that I'm doing or 
some software glitch in my version of Project or Windows. Here the 
screen dump from my session (I named the input and output files to match 
yours):

<dump>
Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit 
(Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
 >>> import win32com.client
 >>>
 >>> project = win32com.client.Dispatch ("MSProject.Application")
 >>> project.FileOpen ("c:/temp/p1.mpp")
True
 >>>
 >>> FILENAME = "c:/temp/p2.csv"
 >>> project.FileSaveAs (Name=FILENAME, FormatID="MSProject.CSV", Map="p1")
True
 >>>
 >>> project.FileClose (Save=0)
True
 >>> project.FileQuit ()
True
 >>>
 >>> print open (FILENAME).read ()
╨╧◄αí▒
</dump>

I'm not sure how those binary characters will be handled by my email 
client, but essentially the file "p2.csv" seems to have been written out 
as a binary project file, not as a CSV file. If I open the file "p2.csv" 
in Project using "All Files" in the open dialog, it loads as an exact 
copy of the original "p1.mpp".

Thanks for your help. I'm really baffled as to why this isn't working.




More information about the python-win32 mailing list