Questions on COM Objects scripting

Maan M. Hamze mmhamze at pleiades.net
Tue Sep 4 09:40:15 EDT 2001


"Mark Hammond" <MarkH at ActiveState.com> wrote in message
news:3B947B51.6070709 at ActiveState.com...
> Maan Hamze wrote:
>
> >>>>from win32com.client import pythoncom
> >>>>pythoncom.LoadTypeLib("d:\winpov\breeze\program\Breeze20.tlb")
> >>>>
> > Traceback (most recent call last):
> >   File "<interactive input>", line 1, in ?
> > com_error: (-2147312566, 'Error loading type library/DLL.', None, None)
>
>
> Note that you have single backslashes, and the "\b" is being translated
> to ASCII 8.
>
:O
Ok! I see!
Taking into account that this is the first time ever I use COM in Python,
one is apt to drop many backslashes on the way :)
>
> > 2.  That is what I am getting in the Python Trace Collector (by using
print
> > globals() in the macro):
> >  {'ax': <win32com.axscript.client.pyscript.AXScriptAttribute instance at
> > 02A815BC>, 'win32traceutil': <module 'win32traceutil' from
> > 'd:\python\win32\lib\win32traceutil.pyc'>, 'Scene':
> > <NamedItemAttribute<ScriptItem at 44574700: Scene>>,
etc......etc.........
> >
> > So, yep, it is....... Scene (not scene).  But it is breeze.scene that is
> > working not Breeze.Scene.
>
>
> OK - so "Scene.whatever" should work :)  Forget everything about
> "Breeze.Scene".  Assume that magically code similar to:
>
> Scene = Dispatch("Breeze.Scene")
>
> has already been executed, and just start using the "Scene" variable.
>
Now I have the complete picture.  Of course globals() is reporting the
object Scene before anything else is dispatched etc.....  So it is already
there.
The problem is that I have tried every combination in the book including the
direct use of scene, and Scene then Dispatch("Breeze.Scene") etc... etc.....
scene, and Scene alike (without using any Dispatch) are causing Python to
report that Scene (or scene for this matter) are undefined names.  This is
strange since Scene IS there.  I may have an idea for what is happening!
Ok!  That is what I wanted to make sure of that PythonWin is not the culprit
here.  So time to give the developer a call and let him know about this :)
Thanks Mark,
Maan





More information about the Python-list mailing list