Python: Open .doc file with antiword on windows
Question: I am trying to open a bunch of .doc files (not docx) in a folder using python.

I downloaded a modified "antiword" which was a precompiled execute file for
windows as the original antiword is only available for linux.

<http://www-stud.rbi.informatik.uni-frankfurt.de/~markus/antiword/>

After I downloaded it I insert it into my python27 folder and I run the
antiword.exe file.

honestly my problem is that I do not understand what is going on when I run
the execute. I had hoped that it would add a library to my python directory
and I could the import "antiword". Can anyone help me?

Thanks a lot.

BR Jonas


Answer: As I understand, antiword is not a python module that you can import. It's an
executable that can be run directly from the command prompt (cmd). I installed
antiword as explained in [00README.WIN document](http://www-
stud.rbi.informatik.uni-frankfurt.de/~markus/antiword/00README.WIN) and could
run it in cmd after adding its folder to PATH environment variable as well as
creating a HOME environment variable exactly as outlined in README. I could
successfully run the following example using testdoc.doc found in
antiword\Doc\

    
    
    antiword -m cp852.txt filename.doc > filename.txt
    

I think if you need to do this in Python, you can run antiword similar to any
cmd command as previously
[explained](http://stackoverflow.com/questions/14894993/running-windows-shell-
commands-with-python). The same thing was previously
[suggested](http://stackoverflow.com/questions/125222/extracting-text-from-ms-
word-files-in-python). You could also give IronPython a try as previuosly
[recommended](http://ironpython.codeplex.com/).

I hope this helps!

