Questions on COM Objects scripting

Maan Hamze mmhamze at pleiades.net
Tue Sep 4 05:49:20 CEST 2001


Mark
Thanks for your reply.  If you can give me some hints to the following, I'll
have all the ideas I need to be able to tell Breeze Designer developer what
is going wrong with his implemetation of Python ActiveScripting macro
capability.  I am quite sure now that it is quite buggy and hopefully he can
fix things.
My first question:
Breeze Desinger comes with Type Library used for reference.  The file is:
Breeze20.tlb.  I was able to load it in Visual Basic 6.0 (from the
References menu by browsing and choosing the tlb file) and look at the
methods and properties of the scene object.
However in PythonWin:
>>> 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)

Breeze20.tlb is used as a reference file.  Why can't PythonWin load it?
Now for the rest of the post:

"Mark Hammond" <MarkH at ActiveState.com> wrote in message
news:3B942FF4.9040006 at ActiveState.com...
> Maan Hamze wrote:
> > 2.  Using Python ActiveScripting
> > From inside the applicatio itself (Breeze Designer) there is a facility
to
> > run Macros with languages with ActiveScripting capabilities including
> > Python.
> > "Breeze.Scene" is created automatically when Breeze is started.
> > a macro starts with $Scripting_Language
>
>
> "Breeze.Scene" should not be created automatically - that would suck.
> Hopefully what you mean is that a "Breeze" object is created, and it
> should have a "Scene" attribute.
>
My mistake Mark.  It was a Typo.  This is what the Breeze doc mentions:
"All  functions are available though the Breeze Designer **scene** object.
This
object is pre-created when using macros **from within Breeze Designer**.
That is
to use any on the following functions a scene. should be added to the front
of the function."

> You could try printing "globals()" to see exactly what is in the
> ActiveScripting namespace.  If "Breeze.Scene" really does exist in the
> namespace, then we will need to pull some tricks to work around a very
> poor decision by the povray people.
>
Actually Breeze Designer is a povray modeller, but it is not done by the
povray people.  It translates a scene/model into povray syntax.
>From inside Breeze Designer I had the macro:
$Python
import win32traceutil
from win32com.client import Dispatch
print globals()   #to print into the Python Trace Collector of PythonWin
scene=Dispatch("breeze.scene")    #notice small case letters :)
rest of code......

Is that the usual way of getting the object when scripting inside an
application (not through PythonWin)?  What I do not like about this program
is that with VBScript, scene object seems to be given.  But with other
scripting languages one has to be able to get the object.  So there must be
some default implementation that allows VBscript to see it, but for Python
to get it before using it (otherwise Python reports that scene is not a
defined name).

Please note that I used "breeze.scene" this time.  I was using
"Breeze.Scene" before because that is what is in the Windows Registry (it is
not listed in PythonWin COM browser so I looked in the registry, found it,
and used it.)  And Breeze.Scene was working while scripting from within
PythonWin.  So it would never have occured to me to use breeze.scene.
1.  breeze.scene IS working now from within a macro in Breeze.  But Breeze
is still crashing sometimes and it got nothing to do with Python.  The
problem is with Breeze Designer when it tries to open the OpenGL Perspective
window.
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.
Maan





More information about the Python-list mailing list