Re: [comtypes-users] 'parameter not optional' problem

2008-04-03 Thread Thomas Heller
Jens schrieb:
> Thank you for the offer.
> 
> It's just a small tool but the problem is you'll need a CAN-Card to
> execute it.
> 
> Probably  I'll get the complete source code of that tool tomorrow.
> Then I can add a new interface method for my own Python needs that is
> easier to use (hopefully) :-).
> 
> And I can try to build a special version without that CAN stuff, maybe
> it is interessting for you to investigate my problem for your further
> comtypes developement ;-). If ok I'll contact you directly by email.

Sure it is.  I am mostly interested to find the remaining bugs in comtypes.

Thomas


-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
comtypes-users mailing list
comtypes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/comtypes-users


Re: [comtypes-users] 'parameter not optional' problem

2008-04-03 Thread Jens
Thank you for the offer.

It's just a small tool but the problem is you'll need a CAN-Card to
execute it.

Probably  I'll get the complete source code of that tool tomorrow.
Then I can add a new interface method for my own Python needs that is
easier to use (hopefully) :-).

And I can try to build a special version without that CAN stuff, maybe
it is interessting for you to investigate my problem for your further
comtypes developement ;-). If ok I'll contact you directly by email.

Thanks,
Jens


Thomas Heller schrieb:
> The easiest way for me to further examine this problem would be if I install
> this com object on my own machine.  Is this possible?
>
> Thanks,
> Thomas
>
>
>   


-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
comtypes-users mailing list
comtypes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/comtypes-users


Re: [comtypes-users] 'parameter not optional' problem

2008-04-02 Thread Thomas Heller
Jens schrieb:
> Hello Thomas,
> 
> (now to correct list address...)

That's great...

> Many thanks for the answer but unfortunately it does not help.

and this is not so great ;-).

> I'm not experienced with (D)COM. As I see if I want to use the CoClass (resp. 
> QueryInterface) I
> have to do this
> 
> from comtypes.gen import AutomaticTesting
> #help (AutomaticTesting.AutomaticTesting)
> self.__appl=CreateObject(AutomaticTesting.AutomaticTesting)
> print self.__appl.SendService("1101").Value()
> 
> 
> but I get the same error "parameter not optional" as well as when I use 
> QueryInterface:
> 
> 
> from comtypes.gen import AutomaticTesting
> instance=comtypes.CoCreateInstance(self.CLSID)
> self.__appl 
> =instance.QueryInterface(AutomaticTesting.IAutomaticTesting)
> print self.__appl.SendService("1101").Value()
> 
> 
>   print self.__appl.SendService("1101").Value()
>   File "C:\Programs\Python25\Lib\site-packages\comtypes\__init__.py", line 
> 414, in func
> return self.Invoke(obj, memid, _invkind=1, *args, **kw) #
> DISPATCH_METHOD  File 
> "C:\Programs\Python25\Lib\site-packages\comtypes\automation.py",line 596, in 
> Invoke
> byref(result), byref(excepinfo), byref(argerr))
> _ctypes.COMError: (-2147352561, 'Parameter nicht optional.', (None, 
> None,None, 0, None))
> 

The easiest way for me to further examine this problem would be if I install
this com object on my own machine.  Is this possible?

Thanks,
Thomas


-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
comtypes-users mailing list
comtypes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/comtypes-users


Re: [comtypes-users] 'parameter not optional' problem

2008-04-02 Thread Jens
Hello Thomas,

(now to correct list address...)

Many thanks for the answer but unfortunately it does not help.

I'm not experienced with (D)COM. As I see if I want to use the CoClass (resp. 
QueryInterface) I
have to do this

from comtypes.gen import AutomaticTesting
#help (AutomaticTesting.AutomaticTesting)
self.__appl=CreateObject(AutomaticTesting.AutomaticTesting)
print self.__appl.SendService("1101").Value()


but I get the same error "parameter not optional" as well as when I use 
QueryInterface:


from comtypes.gen import AutomaticTesting
instance=comtypes.CoCreateInstance(self.CLSID)
self.__appl =instance.QueryInterface(AutomaticTesting.IAutomaticTesting)
print self.__appl.SendService("1101").Value()


  print self.__appl.SendService("1101").Value()
  File "C:\Programs\Python25\Lib\site-packages\comtypes\__init__.py", line 414, 
in func
return self.Invoke(obj, memid, _invkind=1, *args, **kw) #
DISPATCH_METHOD  File 
"C:\Programs\Python25\Lib\site-packages\comtypes\automation.py",line 596, in 
Invoke
byref(result), byref(excepinfo), byref(argerr))
_ctypes.COMError: (-2147352561, 'Parameter nicht optional.', (None, None,None, 
0, None))



I have a Perl example to use this server that works fine:

use strict;
use Win32::OLE;
use Win32::OLE::Variant;

Win32::OLE->Option( Warn => 3 );

my $objApp = Win32::OLE->new("AutomaticTesting.Application","Quit");
my $Result = -1;
my $Answer = Variant(VT_BYREF|VT_VARIANT, Variant(VT_BSTR, ""));

print "Send Service 1101\n";
$Result = $objApp->SendService("1101",$Answer);
if ($Result != 0)
{
  print "Error at 1101!";
  exit();
}

Other ideas ?
Thanks,
Jens



Thomas Heller wrote:
> Jens schrieb:
>   
>> Hi,
>>
>> the COM server I want to use has a method "SendService" with two
>> paramaters, one paramter as "pass by reference" value.
>>
>> When I try the following code:
>>
>> self.__tlb=GetModule(["{C4B24B71-044F-4145-85AD-6401244686CC}",self.MajorVersion,self.MinorVersion])
>> help(self.__tlb)
>> self.__appl=CreateObject(self.APPLICATION)
>> #help(self.__appl) #->exception
>> print self.__appl.SendService("1101").Value()
>>
>>
>> I get the error:
>>
>> --- cut ---
>> File C:\Programs\Python25\Lib\site-packages\comtypes\client\dynamic.py",
>> line 37, in __call__
>> return self._obj._comobj.Invoke(self._id, *args)
>>   File "C:\Programs\Python25\lib\site-packages\comtypes\automation.py",
>> line 596, in Invoke
>> byref(result), byref(excepinfo), byref(argerr))
>> _ctypes.COMError: (-2147352561, 'Parameter nicht optional.', (None,
>> None,None, 0, None))
>> --- cut ---
>>
>>
>> The generated code of:
>> C:\Programs\Python25\Lib\site-packages\comtypes\gen\_C4B24B71_044F_4145_85AD_6401244686CC_0_1_0.py
>>
>> is:
>>
>> [...]
>>
>> IAutomaticTesting._disp_methods_ = [
>> DISPMETHOD([dispid(1), helpstring(u'method SendService')], c_int,
>> 'SendService',
>>( [], BSTR, 'szBuffer' ),
>>( ['retval', 'out'], POINTER(VARIANT), 'pValue' )),
>>
>> [...]
>>
>>
>> I had the same problem with win32com. Here is the solution to use
>> gencache.EnsureModule():
>>
>> self.__early=win32com.client.gencache.EnsureModule(self.CLSID,elf.LCID,self.MajorVersion,self.MinorVersion)
>> self.__appl = win32com.client.Dispatch(self.APPLICATION)
>> self.__appl = self.__early.MyApplication(self.__appl)
>> print self.__appl.SendService("1101") #without exception
>>
>>
>> But how to do it with comtypes ?
>> 
>
> It looks like your CreateObject call is returning a dispatch pointer,
> which does not expose typeinfo (or comtypes is unable to access it, for
> whatever reasons).  In this case, comtypes uses dynamic dispatch calls
> from comtypes\client\dynamic.py.
>
> You could probably either QueryInterface this pointer to the 
> 'IAutomaticTesting'
> interface, or you call CreateObject with the application CoClass defined
> in the generated code.
>
> Does this help?
>
> Thanks,
> Thomas
>
>   


-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
___
comtypes-users mailing list
comtypes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/comtypes-users