[python-win32] UnicodeEncodingError when print a doc file

Tim Roberts timr at probo.com
Wed Jun 15 19:10:05 CEST 2011


cool_go_blue wrote:
> I did try the one you suggest. But I got:
>
>   File "D:\projects\Myself\MySVD\src\ReadWord.py", line 11, in <module>
>    
> app.ActiveDocument.SaveAs('D:\projects\Myself\HelloPython\src\Drugreservoir1.txt',FileFormat=win32com.client.constants.wdFormatText)
>   File
> "D:\Softwares\Python27\lib\site-packages\win32com\client\__init__.py",
> line 170, in __getattr__
>     raise AttributeError(a)
> AttributeError: wdFormatText
>
> Also I replace wdFormatText with wdFormatTextLineBreaks. Same error...
>

How are you creating your Word object?  The Dispatch process should
import these constants for you.

In any case, 15 seconds with Google would have showed you that
wdFormatText = 2 and wdFormatTextLineBreaks = 3.

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the python-win32 mailing list