[Tutor] Com & Python

Danny Yoo dyoo@hkn.eecs.berkeley.edu
Tue, 28 May 2002 10:01:29 -0700 (PDT)


On Tue, 28 May 2002, David wrote:

> Looking for any pointers on working with some com objects!

Hi David,


I'm not sure if many of us here are familiar with Win32/COM stuff.  If you
don't get a good answer from us, you may want to email the python-win32
list on this one.  Here's their link:

    http://mail.python.org/mailman/listinfo/python-win32



> print objApplication.EnableApp
> #works ok up to here - sets the above values correctly
> #At this point can't work out how to get data out of this collections
> object!!!!!...
> ???  objApplication.Sessions  ????
> Have tried just printing it doing
> for x in objApplication.Sessions
> And just get error's

If you can report on the error message as well, that will be helpful for
people, since it might give a hint why the approach isn't quite working.


There are two potential errors I can think might happen at this point:

    AttributeError --- it doesn't know 'objApplication.Sessions'.  Perhaps
        the variable has a different name.

    TypeError --- 'objApplication.Sessions' isn't a Python sequence.
        (Dunno what to do in this case.)


If you can tell us which one of the errors pops up, we might be able to
hunt down more information about this.


Anyway, good luck!