win32com and vb

David Fisher fishboy at SPAMredSPAMpeanutSPAM.com
Thu Jun 17 04:04:02 CEST 2004


allanc <allan_NOSPAMcuenca at nospamyahoo.com> writes:

> i have a python module that i've registered as a com server. i also
> have a vbscript that i use to test the com server. i have a loop
> that creates an instance of the com server on each iteration. but
> each time it creates an object it returns the original (cached
> object), with all the attribute values intact.
> 
> how do i make the python module into a com server that generates a
> unique object instance everytime i call
> CreateObject("python.myPythonModule) in my vbscript?
> 
> psuedocode below:
> 
> vbscript:
> 
> for i = 1 to len(array)
>     	Set myform = CreateObject("python.Template") myform.id =
>     	array(i) myform.addtext(lines(i))
> end
> 

[...]  
This is really more a vbscript thing that a python thing.  Try
explictly deleting the com object in your vbscript.

Set myform = Nothing

"The Set statement assigns the object reference to a variable or
property. The keyword Nothing is used to unassign the object reference
from the variable or property. Good programming techniques require
that you unassign all objects before you exit the program. "

http://www.devguru.com/Technologies/vbscript/quickref/createobj.html

><{{{*>



More information about the Python-list mailing list