Path: csiph.com!usenet.pasdenom.info!aioe.org!rt.uk.eu.org!nntp-feed.chiark.greenend.org.uk!ewrotcd!news.nosignal.org!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python.': 0.02; 'win32': 0.03; 'syntax': 0.03; 'args': 0.04; 'argument': 0.04; 'great.': 0.07; 'params': 0.07; 'supported,': 0.07; 'python': 0.09; '0),': 0.09; 'expected.': 0.09; 'from:name:bitbucket': 0.09; 'to:addr:comp.lang.python': 0.09; 'tuple': 0.09; 'cc:addr:python- list': 0.10; 'def': 0.10; 'subject:python': 0.11; 'library': 0.15; '(24,': 0.16; '(8,': 0.16; 'code?': 0.16; 'hopeful': 0.16; 'invoking': 0.16; 'makepy': 0.16; 'mark,': 0.16; 'param': 0.16; 'subject: \n ': 0.16; 'subject:accessing': 0.16; 'subject:which': 0.16; 'url:html)': 0.16; 'url:oreilly': 0.16; 'wrote:': 0.17; 'saying': 0.18; 'appears': 0.18; 'subject:) ': 0.20; 'object.': 0.22; 'void': 0.22; 'help.': 0.22; 'programming': 0.23; 'work.': 0.23; 'monday,': 0.23; 'tried': 0.25; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'appear': 0.26; 'values': 0.26; 'supported': 0.26; 'cc:addr:gmail.com': 0.27; 'cc:2**2': 0.27; 'functions.': 0.27; "doesn't": 0.28; 'noticed': 0.28; 'reply.': 0.28; 'run': 0.28; 'attempted': 0.29; 'python).': 0.29; 'though.': 0.29; 'case,': 0.29; 'convert': 0.29; "i'm": 0.29; 'knows': 0.30; 'function': 0.30; 'december': 0.32; 'could': 0.32; 'skip:s 30': 0.33; 'values.': 0.33; "can't": 0.34; 'received:google.com': 0.34; 'thanks': 0.34; 'server': 0.35; 'list': 0.35; 'received:209.85': 0.35; 'but': 0.36; 'cc:no real name:2**1': 0.36; 'email addr:python.org': 0.36; 'subject: (': 0.36; 'does': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'mark': 0.38; 'object': 0.38; 'description': 0.39; 'instead': 0.39; 'received:209.85.214': 0.39; 'takes': 0.39; 'little': 0.39; 'where': 0.40; 'your': 0.60; 'different': 0.63; 'below.': 0.68; 'pain': 0.84; 'received:209.85.214.184': 0.84; 'received:mail- ob0-f184.google.com': 0.84 Newsgroups: comp.lang.python Date: Tue, 11 Dec 2012 07:48:53 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=24.229.66.143; posting-account=_dxy0QoAAAD9TKmsbQw-qXFKhMwXoPgn References: <38a14001-82b6-4a91-b3ad-2cb5c8ee580d@googlegroups.com> User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-IP: 24.229.66.143 MIME-Version: 1.0 Subject: Re: accessing an OLE Automation (IDispatch) server from python which requires the use of "out params" From: bitbucket To: comp.lang.python@googlegroups.com Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: mhammond@skippinet.com.au, python-list@python.org, bitbucket X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Message-ID: Lines: 61 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1355240942 news.xs4all.nl 6883 [2001:888:2000:d::a6]:38635 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:34629 On Monday, December 10, 2012 8:16:43 PM UTC-5, Mark Hammond wrote: > "out" params are best supported if the object supplied a typelib - then= =20 > Python knows the params are out and does the right thing automagically.= =20 > If out params are detected, the result of the function will be a tuple= =20 > of (real_result, out_param1, ...) >=20 > Even if no typelib is supported, you can access them with a little pain= =20 > via the win32com.client.Dispatch() object. You might like to follow up= =20 > to the python-win32@python.org mailing list where many people will be=20 > able to help. >=20 > HTH, >=20 > Mark Mark, thanks for the reply. In this case, I have a type library and attemp= ted to use MakePy but it doesn't seem to be working as expected. I was reading through CH12 of your Python Programming on Win32 book (http:/= /oreilly.com/catalog/pythonwin32/chapter/ch12.html). I was hopeful given y= our description of MakePy that I could get this to work. It appears that y= ou're saying MakePy will convert "byref" args in a function over to return = values. For example, the IDL in the server includes the following 3 functions. [id(1)] void ShowMessage(BSTR msg); [id(2)] void GetSettingValue(BSTR settingName, BSTR* settingValue); [id(3)] void SetSettingValue(BSTR settingName, BSTR settingValue); The thorny one is the GetSettingValue since it takes the out param. When I= run MakePy, it generates the below. def ShowMessage(self, msg=3DdefaultNamedNotOptArg): return self._oleobj_.InvokeTypes(1, LCID, 1, (24, 0), ((8, 0),),msg ) def GetSettingValue(self, settingName=3DdefaultNamedNotOptArg, settingValu= e=3DdefaultNamedNotOptArg): return self._oleobj_.InvokeTypes(2, LCID, 1, (24, 0), ((8, 0), (16392, 0)= ),settingName , settingValue) def SetSettingValue(self, settingName=3DdefaultNamedNotOptArg, settingValu= e=3DdefaultNamedNotOptArg): return self._oleobj_.InvokeTypes(3, LCID, 1, (24, 0), ((8, 0), (8, 0)),se= ttingName , settingValue) I noticed that the argument type is different for the out param (16392 inst= ead of 8). However, it doesn't appear to me that its generating return val= ues instead of args (though I'm not very experienced in python). I tried invoking these in python. The ShowMessage and SetSettingValue work= great. I can't get the GetSettingValue to work though. Perhaps there's a= different syntax I need when using the MakePy generated code?