query regarding NULL result without error in COM code
Ken Guest
kwg at renre-europe.com
Thu Dec 13 07:39:56 EST 2001
hi,
I've run into a "NULL result without error in call_object" system error
after using the DefaultDebugDispatcher in the COM code that I'm writing.
(This error wasn't being raised before hand, when I didn't specify which
dispatcher was to be used. The reason why I'm now using the
DefaultDebugDispatcher is that there's an error happening later on in my
code that I have to get to the bottom of).
The error happens when I try to create a 'COMObjectServer' in some VB
code:
Set svr = _
VBA.CreateObject("renre.gps_layerstats.Objects.COMObjectServer")
Now the python code that I have for this is as follows.
(The sample code in the docstring works fine if I don't use that
DefaultDebugDispatcher)
I've checked through chapter 12 of the "Programming Python on Win32"
and through Google and can't find anything that suggests a solution.
I'd really appreciate it if someone could please help shed some light
on this.
thanks
k.
class COMObjectServer:
"""
Used for serving out objects via COM.
Tested and found to be working with the following code:
Private Sub Document_Open()
Dim svr As Object
Dim obj As Object
Set svr =
VBA.CreateObject("renre.gps_layerstats.Objects.COMObjectServer")
Stop
End Sub
set obj = svr.object("renre.gps_layerstats.Objects.LatestRunObject")
f = obj.num_tabs_required()
print f
4
"""
_reg_clsid_ = "{AB07AB91-01EE-4FDD-A2D2-3A46E3488AE5}"
_reg_desc_ = "renre.gps_layerstats.Objects.COMObjectServer"
_reg_progid_ = "renre.gps_layerstats.Objects.COMObjectServer"
_reg_class_spec_= "renre.gps_layerstats.Objects.COMObjectServer"
_public_methods_ = ["object"]
def object(self, class_name):
from win32com.server.util import wrap
from win32com.server.dispatcher import
DefaultDebugDispatcher
obj = dynamic_load2(class_name)
comobj = wrap(obj, useDispatcher =
DefaultDebugDispatcher)
return comobj
--
The duck quacks.
More information about the Python-list
mailing list