win32com.client - missing methods?
Kirby James
kirby at jamesk.freeserve.co.uk
Fri Jan 26 13:01:25 EST 2001
Hi, I've written a Python program which uses the win32com interface to
obtain information from a number of Word-97 files.
The program runs fine on my Win-98 system but fails on two NT systems.
The problem line is :-
sAuthor = myDoc.BuiltInDocumentProperties(constants.wdPropertyAuthor)
which produces the error
AttributeError: no __call__ method defined
When I remove this line the other COM functions that I call work fine. On
all three systems I've run the COM Makepy utility - but I notice that
the generated files are of different sizes on the different systems (is it
safe to copy - and rename the win-98 file to NT).
I'd appreciate any pointers
ta, Kirby
Traceback (most recent call last):
File "D:\Python20\Pythonwin\pywin\framework\scriptutils.py", line 301, in
RunScript
exec codeObject in __main__.__dict__
File "D:\python\utilities\word2.py", line 178, in ?
os.path.walk('d:\\relocation', walker, 10)
File "D:\Python20\lib\ntpath.py", line 270, in walk
walk(name, func, arg)
File "D:\Python20\lib\ntpath.py", line 264, in walk
func(arg, top, names)
File "D:\python\utilities\word2.py", line 153, in walker
readWord(pathfilename)
File "D:\python\utilities\word2.py", line 64, in readWord
sAuthor = myDoc.BuiltInDocumentProperties(constants.wdPropertyAuthor)
AttributeError: no __call__ method defined
WORD = 'Word.Application.8'
myWord = Dispatch(WORD)
myWord.Visible = 1
myDoc = myWord.Documents.Open(fn)
sAuthor = myDoc.BuiltInDocumentProperties(constants.wdPropertyAuthor)
#### line 64
sAuthor = str(sAuthor)
print ' Author = ' + sAuthor
More information about the Python-list
mailing list