Erratic import behavior

Jon jonparkinson at hotmail.com
Sat Mar 22 03:07:34 EST 2003


I've been butting my head against this one all day.  I'm learning how
to use COM in Python and all the examples I've seen look something
like:

from win32com.client import Dispatch
xlApp = Dispatch("Excel.Application")

This has worked great for me in PythonWin, but when I run the exact
same program from command prompt I get a python.exe Application Error.

I've figured out another way of doing it that works for both:

import win32com, win32com.client
xlApp = win32com.client.Dispatch("Excel.Application")

What I would like to know is why is there a difference in behavior
between running my code in PythonWin and running it from the command
prompt?

Any help would be much appreciated.  I'm just starting out on a big
project and hate to have doubts about how everything is working (or
not working) right at the beginning.




More information about the Python-list mailing list