title: passing arguments to COM object in python
body: <p>I am writing a python script to control a Com object. The official documentation is in C#, VB and C.
  the documentation (in VB) is as follows:</p>
  
  <pre><code>Public Function GetDATA { 
  ByVal vecRecords() As DATAType,
  ByRef Time As String, 
  optional ByVal filter1 As String, 
  optional ByVal kind2 As Kind = KindAll, 
  optional ByVal type1 As Types = TypeAll 
  ) As Long 
  </code></pre>
  
  <p>As far as i can tell, the 1st argument is the return value and is returned as normal in python. Last three arguments are enum types (translated in to numbers) but are optional in any case.
  I am left wit the question what argument do I pass in "ByRef Time As String"?</p>
  
  <p>my code is:</p>
  
  <pre><code>&gt;&gt;&gt; from win32com.client import Dispatch
  &gt;&gt;&gt; Obj = Dispatch("Service.Foo")
  &gt;&gt;&gt; Obj.Function()
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
    File "D:\Python27\lib\site-packages\win32com\gen_py\48C77DB1-D9E0-45B8-9992-C9
  2B047CC700x0x1x0.py", line 399, in Function 
      , LastTime, BNO, kind, madadType)
    File "D:\Python27\lib\site-packages\win32com\client\__init__.py", line 456, in
   _ApplyTypes_
      self._oleobj_.InvokeTypes(dispid, 0, wFlags, retType, argTypes, *args),
  pywintypes.com_error: (-2147023170, 'The remote procedure call failed.', None, None)
  </code></pre>
  
  <p>I also ran:</p>
  
  <pre><code>&gt;&gt;&gt; Obj.Function()
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
    File "D:\Python27\lib\site-packages\win32com\gen_py\48C77DB1-D9E0-45B8-9992-C9
  2B047CC700x0x1x0.py", line 399, in Function 
      , LastTime, BNO, kind, madadType)
    File "D:\Python27\lib\site-packages\win32com\client\__init__.py", line 456, in
   _ApplyTypes_
       self._oleobj_.InvokeTypes(dispid, 0, wFlags, retType, argTypes, *args),
   TypeError: Objects for SAFEARRAYS must be sequences (of sequences), or a bufferobject.
  </code></pre>
  
  <p>and:</p>
  
  <pre><code>&gt;&gt;&gt; a= ("00000000","00000000",-1,-1)
  &gt;&gt;&gt; Obj.Function(a)
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
    File "D:\Python27\lib\site-packages\win32com\gen_py\48C77DB1-D9E0-45B8-9992-C9
  2B047CC700x0x1x0.py", line 399, in Function 
      , LastTime, BNO, kind, madadType)
    File "D:\Python27\lib\site-packages\win32com\client\__init__.py", line 456, in
   _ApplyTypes_
       self._oleobj_.InvokeTypes(dispid, 0, wFlags, retType, argTypes, *args),
  MemoryError: CreatingSafeArray
  </code></pre>
  
  <p>The retvalue is not too big, so i really do not understand the last one.</p>
  
  <p>system:
  windows 7 64bit.
  python 2.7.2 32 bit (running from cmd started as administrator,  the COM object needs it.)</p>
  
  <p>Is there a simple way to discover what the function wants? </p>
  
  <p>Thanks in advance
  Marbs.</p>
  
  <p>[Edit]
  I give you a working C# Code Snippet:</p>
  
  <pre><code>System.Array tempArray;
  string lTime = "00000000";
  Res = Obj.getDATA(out tempArray, ref lTime, "0", Obj.type1, Obj.type2);  
  </code></pre>
  
  <p>Where Obj.type1 and Obj.type2 are enums form the Obj it self. They both translate in to -1 (an int).</p>