[python-win32] Python/Palm Parameter passing problems...

Blake Winton bwinton at latte.ca
Fri Jul 23 17:44:51 CEST 2004


So, I'm trying to write a conduit for my Palm in Python, using the COM 
interface.

I've successfully implemented the Interface I need to, and I can run my 
conduit, and even call some methods, however, I'm running into a problem 
calling the following method:
Function ReadNextModifiedInCategory(nIndex as Long, vUniqueId as 
Variant, nCategory as Long, nAttributes as ERecordAttributes) as Variant

Parameters
<- nIndex Index of returned record.

<- vUniqueId Unique ID of returned record.

-> nCategory Category ID of record to return.

<- nAttributes Attributes from the ERecordAttributes constants.

Returns
For PDRecordAdapter objects representing any database, returns a Byte 
array containing record data.

The generated Python method is:
   def ReadNextModifiedInCategory(self, nIndex=pythoncom.Missing, 
pvUniqueId=pythoncom.Missing, nCategory=defaultNamedNotOptArg, 
eAttributes=pythoncom.Missing):
     """method ReadNextModifiedInCategory"""
     return self._ApplyTypes_(7, 1, (12, 0), ((16387, 2), (16396, 2), 
(3, 1), (16387, 2)), 'ReadNextModifiedInCategory', None,nIndex, 
pvUniqueId, nCategory, eAttributes)


I've tried the following calls:
categoryId = 17
# ---
z = adapter.ReadNextModifiedInCategory( nCategory=categoryId )
# ---
index, uid, attribs = 0, 0, 0
z=adapter.ReadNextModifiedInCategory( index, uid, categoryId, attribs )
# ---
index, uid, attribs = 0, "0000", 0
uid2 = buffer(uid)
z=adapter.ReadNextModifiedInCategory( index, uid2, categoryId, attribs )
# ---
index, uid, attribs = 0, "0000", 0
z=adapter.ReadNextModifiedInCategory( index, uid, categoryId, attribs )
# ---

And none of them seem to work.

The first one gives me:
Traceback (most recent call last):
   File "C:\PROGRA~1\Python\lib\site-packages\conduit\PyConduit.py", 
line 81, in BeginProcess
     z = adapter.ReadNextModifiedInCategory( nCategory=categoryId )
   File 
"C:\PROGRA~1\Python\lib\site-packages\win32com\gen_py\6FD7A7A1-FA1F-11D2-AC32-006008E3F0A2x0x1x0.py", 
line 1251, in ReadNextModifiedInCategory
     return self._ApplyTypes_(7, 1, (12, 0), ((16387, 2), (16396, 2), 
(3, 1), (16387, 2)), 'ReadNextModifiedInCategory', None,nIndex, 
pvUniqueId, nCategory, eAttributes)
   File 
"C:\PROGRA~1\Python\lib\site-packages\win32com\client\__init__.py", line 
445, in _ApplyTypes_
     return self._get_good_object_(self._oleobj_.InvokeTypes(*((dispid, 
0, wFlags, retType, argTypes) + args)), user, resultCLSID)
TypeError: int() argument must be a string or a number

And the others give me:
Traceback (most recent call last):
   File "C:\PROGRA~1\Python\lib\site-packages\conduit\PyConduit.py", 
line 80, in BeginProcess
     z = adapter.ReadNextModifiedInCategory( index, prefs, categoryId, 
attribs )
   File 
"C:\PROGRA~1\Python\lib\site-packages\win32com\gen_py\6FD7A7A1-FA1F-11D2-AC32-006008E3F0A2x0x1x0.py", 
line 1251, in ReadNextModifiedInCategory
     return self._ApplyTypes_(7, 1, (12, 0), ((16387, 2), (16396, 2), 
(3, 1), (16387, 2)), 'ReadNextModifiedInCategory', None,nIndex, 
pvUniqueId, nCategory, eAttributes)
   File 
"C:\PROGRA~1\Python\lib\site-packages\win32com\client\__init__.py", line 
445, in _ApplyTypes_
     return self._get_good_object_(self._oleobj_.InvokeTypes(*((dispid, 
0, wFlags, retType, argTypes) + args)), user, resultCLSID)
com_error: (-2147352567, 'Exception occurred.', (0, 
'PDDirect.PDRecordAdapter.1', 'Parameter error', None, 0, -2147213312), 
None)

Any ideas what I might be doing wrong here, or how I could find out what 
parameter to pass?  I'm fairly sure that the problem is with the second 
parameter, pvUniqueId, the [out] Variant, but I can't quite figure out 
what I should change it to.

Thanks,
Blake.


More information about the Python-win32 mailing list