I am writing a script (a full-fledged program, actually) in PYTHON (version 2.5; the current version is 3.0 but there are some performance problems -- 3.0 is slower than 2.5; go figure). The program allows a user to open a file in WORD. I have tested this program on an XP machine and a VISTA Home Premium machine. With WORD 2003 installed, there is no problem. I call the typical open file box, the user selects a file, WORD comes up (slowly) on the screen and the file displays in WORD. On the machine in my office in Camden where we have WORD 2007, everything happens like before EXCEPT the file does not display in WORD. Indeed, there is an error. The errors are shown in two files attached to this email. Note the difference in exit codes. When I used a global variable to hold the file name, I got an exit code of 1 (bad exit). When I rewrote the file to use a function which passed a local variable, I got an exit code of 0 (which indicates that everything went well) EXCEPT that there was no difference in behavior. The file still did not open in WORD 2007. I'm puzzled to say the least.
I have checked with Microsoft's MSDN and there doesn't seem to be any difference in the COM calls from 2003 to 2007 (I did have to modify my code somewhat to get 2003 to work since I was looking at a book that called WORD 97 and there IS a difference in the name of a WORD method). I also sent a post to the Portable PYTHON list about this but have not yet received a reply. PYTHON doesn't have native support for COM. That comes from an added series of modules which need to be separately downloaded and installed, which I have done. They are functionally the same as modules for the desktop version of PYTHON and, presumably, work the same way, since they were written by the same person. Any ideas?
ITBarbie 0 Newbie Poster
leegeorg07
ITBarbie 0 Newbie Poster
leegeorg07
vegaseat 1,735 DaniWeb's Hypocrite Team Colleague
ITBarbie 0 Newbie Poster
leegeorg07
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.