Hi there:
I have the following bit of test code:

from WebKit.Page import Page
from win32com.client import Dispatch

class COMTest(Page):
    def __init__(self):
        Page.__init__(self)

    def writeContent(self):
        # grab the COM object
        bestOffer = Dispatch("ComTMW.tmwBestOffer")
        self.writeln('<pre>')
        self.writeln('bestOffer: %s' % repr(bestOffer))
        demands = bestOffer.SetDemand(2)
        self.writeln('demands: %s' % repr(demands))
        self.writeln('</pre>')

I do have COMKit installed.

If I run this code from the python shell I get:

>>> foo = COMTest.COMTest()
>>> def writeln(foo):
... print foo
...
>>> foo.writeln = writeln
>>> foo.writeContent()
<pre>
bestOffer: <win32com.gen_py.03D57A28-498A-484F-873A-266C0E854A66x0x14x0._tmwBestOffer instance at 0x22765200>
demands: ((<win32com.gen_py.03D57A28-498A-484F-873A-266C0E854A66x0x14x0._Demand instance at 0x22764120>, <win32com.gen_py.03D57A28-498A-484F-873A-266C0E854A66x0x14x0._Demand instance at 0x22765440>), 2)
</pre>


However, If I run it from within Webware, I get this returned as content:

<pre>
bestOffer: <COMObject ComTMW.tmwBestOffer>
demands: ((<PyIDispatch at 0x9963f4 with obj at 0x1bc864>, <PyIDispatch at 0x995b04 with obj at 0x1bcf3c>), 2)
</pre>


The problem I get is that if I now try to set an attribute in one fo the objects in the demands array by writing:

demands[0][0].Adults = 2

this works fine on the python shell but with webware I get the error:

TypeError: PyIDispatch has read-only attributes

This is because I'm tryign to assign a variable to what I thoguht was an early-bound COM object. So I'm wondering how to convince Webware to use early-bound COM objects.

Webware is 0.8.2, Python is 2.3 and both the Webware and Python shell had the win32com\gen_py directory in the correct location in sys.path

Any ideas?

--
           Giles Antonio Radford, a.k.a Moof
Sympathy, eupathy, and, currently, apathy coming to you at:
                <http://metamoof.net/>




------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. SourceForge.net hosts over 70,000 Open Source Projects. See the people who have HELPED US provide better services: Click here: http://sourceforge.net/supporters.php _______________________________________________ Webware-discuss mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to