[python-win32] Working with a PyIDispatch object

2005-02-03 Thread Greg Lee
Title: Working with a PyIDispatch object I'm using MSXML2.SAXXMLReader.4.0 to validate XML.  Following a hint posted July 2 by the estimable Mark Hammond, I implemented the error handler thus: class MyErrorHandler:     _com_interfaces_ = ['IVBSAXErrorHandler']     _public_methods_ = ['e

Re: [python-win32] Creating a COM singleton

2005-02-03 Thread Jens B. Jorgensen
Jim McCoy wrote: Argh! Well, it turns out that the real problem was that when creating a mutex for a module-level singleton you should not store a ref to the handle in an instance that might find itself getting popped. Assign to a class variable that will stick. D'oh! I will take a look at setti

RE: [python-win32] Working with a PyIDispatch object

2005-02-03 Thread Mark Hammond
You can convert it to a "friendly" object simply by doing: locator = win32com.client.Dispatch(locator) If you want to ensure early binding, try: locator = win32com.client.gencache.EnsureDispatch(locator) That should generate a makepy file for the interface on the fly (but doesn't work for a

RE: [python-win32] python ScriptControl error in Excel while runningfine in python

2005-02-03 Thread Mark Hammond
> I am trying to use ScriptControl under Excel (Windows XP) > with the code: > > Global sc As New MSScriptControl.ScriptControl > > Public Function os_getcwd() > sc.Language = "python" > sc.ExecuteStatement ("import os") > os_getcwd = sc.Eval("os.getcwd()") > End Function > > When setti