473,396 Members | 2,111 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Optional Parameters in python COM

Hi,

I am using python with a makepy generated wrapper on a COM application. One
of this object's methods has 3 parameters, two of which are optional.
If I call the method with just the non-optional parameter, or all three
parameters, it works. If I call it with the first two parameters, I get the
following error:

(-2147352567, 'Exception occurred.', (0, 'Amphora.Session.1', 'A bad
parameter was passed to the method', None, 0, -1610547133), None)

I have tried calling the method by using the names of the optional
parameters, and I have also tried using pythoncom.Missing and
pythoncom.Empty for the non essential parameter. I have also edited the
generated .py file so that it contains the following:

defaultNamedOptArg=pythoncom.Empty
defaultNamedNotOptArg=pythoncom.Empty
defaultUnnamedArg=pythoncom.Empty

But this has not made any difference! Any help would be very much
appreciated.

Cheers,

Rane
Jul 18 '05 #1
3 4293
<bump>

"Rane Bowen" <ra***@slingshot.co.nz> wrote in message
news:bv**********@lust.ihug.co.nz...
Hi,

I am using python with a makepy generated wrapper on a COM application. One of this object's methods has 3 parameters, two of which are optional.
If I call the method with just the non-optional parameter, or all three
parameters, it works. If I call it with the first two parameters, I get the following error:

(-2147352567, 'Exception occurred.', (0, 'Amphora.Session.1', 'A bad
parameter was passed to the method', None, 0, -1610547133), None)

I have tried calling the method by using the names of the optional
parameters, and I have also tried using pythoncom.Missing and
pythoncom.Empty for the non essential parameter. I have also edited the
generated .py file so that it contains the following:

defaultNamedOptArg=pythoncom.Empty
defaultNamedNotOptArg=pythoncom.Empty
defaultUnnamedArg=pythoncom.Empty

But this has not made any difference! Any help would be very much
appreciated.

Cheers,

Rane

Jul 18 '05 #2
<grind>
"Rane Bowen" <ra***@slingshot.co.nz> wrote in message
news:bv**********@lust.ihug.co.nz...
<bump>

"Rane Bowen" <ra***@slingshot.co.nz> wrote in message
news:bv**********@lust.ihug.co.nz...
Hi,

I am using python with a makepy generated wrapper on a COM application.

One
of this object's methods has 3 parameters, two of which are optional.
If I call the method with just the non-optional parameter, or all three
parameters, it works. If I call it with the first two parameters, I get

the
following error:

(-2147352567, 'Exception occurred.', (0, 'Amphora.Session.1', 'A bad
parameter was passed to the method', None, 0, -1610547133), None)

I have tried calling the method by using the names of the optional
parameters, and I have also tried using pythoncom.Missing and
pythoncom.Empty for the non essential parameter. I have also edited the
generated .py file so that it contains the following:

defaultNamedOptArg=pythoncom.Empty
defaultNamedNotOptArg=pythoncom.Empty
defaultUnnamedArg=pythoncom.Empty

But this has not made any difference! Any help would be very much
appreciated.

Cheers,

Rane


Jul 18 '05 #3
Rane Bowen wrote:
Hi,

I am using python with a makepy generated wrapper on a COM application. One
of this object's methods has 3 parameters, two of which are optional.
If I call the method with just the non-optional parameter, or all three
parameters, it works. If I call it with the first two parameters, I get the
following error:

(-2147352567, 'Exception occurred.', (0, 'Amphora.Session.1', 'A bad
parameter was passed to the method', None, 0, -1610547133), None)

I have tried calling the method by using the names of the optional
parameters, and I have also tried using pythoncom.Missing and
pythoncom.Empty for the non essential parameter. I have also edited the
generated .py file so that it contains the following:

defaultNamedOptArg=pythoncom.Empty
defaultNamedNotOptArg=pythoncom.Empty
defaultUnnamedArg=pythoncom.Empty

But this has not made any difference! Any help would be very much
appreciated.


Can you reproduce this problem with a "common" object, such as IE,
MSOffice, or a trivial VB object with sourcecode? The problem is that
it is up to each object to implement optional params, so it is very hard
to pinpoint bugs in win32com here.

Mark.

Jul 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Philip Rittenhouse | last post by:
I have discovered a couple of problems with the way the universal gateway code handles optional parameters and variable argument lists in COM servers. It appears to only be a problem when you...
13
by: William Ryan | last post by:
I just picked up a copy of John Robbins' debugging book and started to look at disassembled code. Anyway, I hate optional Parameters in VB, but I was checking them out to see what IL is created. ...
16
by: ad | last post by:
Does C#2.0 support optional parameters like VB.NET: Function MyFunction(Optional ByVal isCenter As Boolean = False)
14
by: cody | last post by:
I got a similar idea a couple of months ago, but now this one will require no change to the clr, is relatively easy to implement and would be a great addition to C# 3.0 :) so here we go.. To...
5
by: Miro | last post by:
This qustion is probably for people who have created large apps with subs / or functions that have a lot of parameters and used in a lot of places in ur whole app. ( lets say its ur own library...
12
by: pamelafluente | last post by:
Hi guys, In the past I have used several time optional parameters in my function. But Now I am more inclined to think that they are more dangerous than useful, and probably better to be...
1
by: peridian | last post by:
This is more of a general question, but I didn't know where to post it. Since Java is an example of a language which does this, I thought here would work. Coming from a C++ background, having...
1
by: MisterWilliam | last post by:
I noticed that in PEP 3105, the PEP about turning print to print(), the syntax for print() is defined as follows: def print(*args, sep=' ', end='\n', file=None) Ignoring the fact that print is a...
7
by: jamesclose | last post by:
My problem is this (apologies if this is a little long ... hang in there): I can define a function in VB.NET with optional parameters that wraps a SQL procedure: Sub Test(Optional ByVal Arg1...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.