cool_go_blue wrote:
> this is the first three lines of my code:
>
> app = win32com.client.Dispatch('Word.Application')
> app.Documents.Open('D:\projects\Myself\HelloPython\src\Drugreservoir.doc')
> app.ActiveDocument.SaveAs('D:\projects\Myself\HelloPython\src\Drugreservoir1.txt',FileFormat=win32com.client.constants.wdFormatText)
>

If you use this instead:
    app = win32com.client.gencache.EnsureDispatch('Word.Application')
then the framework will build a Python wrapper for objects of that type,
and that Python wrapper will create the constants.

You MUST get in the habit of using the proper escape characters.  The
backslash has special meaning in Python strings.  You have three choices:

1. Use a "raw" string:
   
apps.Documents.Open(r'D:\projects\Myself\HelloPython\src\Drugreservoir.doc')
2. Double the backslashes:
   
apps.Documents.Open('D:\\projects\\Myself\\HelloPython\\src\\Drugreservoir.doc')
3. Use forward slashes:
   
apps.Documents.Open('D:/projects/Myself/HelloPython/src/Drugreservoir.doc')

-- 
Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc.

_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to