[Tutor] Automating MSWord (error if run from command line; no error if ru n within PythonWin)

Ezequiel, Justin j.ezequiel@spitech.com
Fri Mar 21 01:06:39 2003


I am getting the following message when running my program from the command line (X:\>python DelStyles.py jd002790.doc).
The program runs file under PythonWin (Ctrl-R)!
I am using Python 2.2.2 on WinXP Service Pack 1.
I've installed py2exe-0.3.3.win32-py2.2.exe and win32all-152.exe in that order, if it matters.
Ultimately, I would like to package my program using py2exe.
I can attach the entire program if you like (104 lines).
Thanks in advance.

Processing jd002790.doc
Saving as RTF...
Traceback (most recent call last):
  File "DelStyles.py", line 101, in ?
    process(sys.argv[1])
  File "DelStyles.py", line 90, in process
    SaveFile(sFile, sRTFFile, 6)
  File "DelStyles.py", line 82, in SaveFile
    doc = win32com.client.GetObject(sOldFile)
  File "D:\PYTHON22\lib\site-packages\win32com\client\__init__.py", line 73, in
GetObject
    return Moniker(Pathname, clsctx)
  File "D:\PYTHON22\lib\site-packages\win32com\client\__init__.py", line 89, in
Moniker
    dispatch = moniker.BindToObject(bindCtx, None, pythoncom.IID_IDispatch)
pywintypes.com_error: (-2147287038, 'STG_E_FILENOTFOUND', None, None)