Dispatch("Excel.Application") failed

John Machin sjmachin at lexicon.net
Thu Mar 13 22:57:25 CET 2008


On Mar 13, 5:02 pm, lialie <lia... at gmail.com> wrote:
> Hi,
> Maybe it 's quite simple, but I can't fix it. Do I make some mistakes in
> my env setting? My excel version is 2003.
> any suggestion? Thanks.
>
> Traceback (most recent call last):
> File "testexcel.py", line 3, in ?
> excel = Dispatch("Excel.Application")
[snip]
> pywintypes.com_error: (-2147221005,
> '\xce\xde\xd0\xa7\xb5\xc4\xc0\xe0\xb1\xf0\xd7\xd6\xb7\xfb\xb4\xae',
> None, None)

Googling for 2147221005 gives some clues.

That string of hex stuff appears where an error message is expected --
it's not utf8, and makes no sense when I attempt to decode it with
cp1250 to cp1258 inclusive. If you start IDLE and type:

import sys; sys.stdout.encoding

what do you see?



More information about the Python-list mailing list