Python Forum
how to handle COM Typelib OUT parameters?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to handle COM Typelib OUT parameters?
#1
Hello!
I try to convert VB-Script to Python script.
I use the packages pywin32, comtypes and pythoncom

I have problems with function imported from typelib having out parameters

e.g. the code with comtypes.client.GetModule generated import file:

COMMETHOD([dispid(1610809357), helpstring('attributes at given index, returns optionally attributes range'), 'propget'], HRESULT, 'Attributes',
              ( ['in'], c_int, 'index' ),
              ( ['out', 'optional'], POINTER(VARIANT), 'range', 0 ),
              ( ['out', 'retval'], POINTER(POINTER(IPLDictionary)), 'pVal' ))
How to handle the out parameter 'range', which have not the retval attribute?

Although I have declared the values
actIndex : int = textRange[0]
attributesRange : COM.VARIANT = COM.VARIANT(pythoncom.VT_BYREF | pythoncom.VT_ARRAY, [ 0, 0])
with
gotattributes = textInLayer.Attributes(actIndex, attributesRange)
I got
TypeError
int() argument must be a string, a bytes-like object or a number, not 'NoneType'

Thank you for advice
Erhy
Reply
#2
after many days I quit.
It seems there is no way to code for functions with OUT parameters defined in IDL.

My last trying was to import only win32com.client, but the error message is the same:
int() argument must be a string, a bytes-like object or a number, not 'NoneType'
Tried also with python and pywin32-master from source, but I was not able to find the reason in debug mode.

Had a great hope to port .vbs scripts to python scripts
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  enum from typelib Erhy 2 2,121 Jan-26-2019, 05:37 PM
Last Post: Erhy

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020