win32com and vb
kawenksNO123SPAM at NOSPAMyahoo.ca
Thu Jun 17 12:14:58 CEST 2004
[posted and mailed]
On 16 Jun 2004, you wrote in comp.lang.python:
> 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:
>> for i = 1 to len(array)
>> Set myform = CreateObject("python.Template") myform.id =
>> array(i) myform.addtext(lines(i))
> 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. "
i did try deleting the object as above. to no avail. i'm assuming that the
com server created from my python class can be instantiated by several
processes (or multiple users) and each will have a separate and unique
instance without having to make "special arrangements" in my python class.
i'm planning to use the python class as an activex component in an asp
script. i'm trying to make sure each user will be able to create their own
unique object. i read somewhere that the class attributes need to be
modified in some way (made private? with get/set methods?) so that these
don't get shared across several instances of the object created.
More information about the Python-list