Fix errors in Word file parsing.

This commit is contained in:
Bastian Kleineidam 2010-03-07 19:43:08 +01:00
parent 6a2fcf8ae9
commit 1e15e55689
2 changed files with 4 additions and 1 deletions

View file

@ -920,7 +920,7 @@ class UrlBase (object):
try:
app = winutil.get_word_app()
try:
doc = winutil.open_word(app, filename)
doc = winutil.open_wordfile(app, filename)
try:
for link in doc.Hyperlinks:
url_data = get_url_from(link.Address,

View file

@ -65,6 +65,9 @@ def get_word_app ():
"""Return open Word.Application handle, or None on error."""
if not has_word():
return None
# Since this function is called from different threads, initialize
# the COM layer.
pythoncom.CoInitialize()
import win32com.client
app = win32com.client.gencache.EnsureDispatch("Word.Application")
app.Visible = False