473,320 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,320 software developers and data experts.

"bad argument type for built-in operation"

Hello,

I've got a nasty bug and no idea to deal with :

here is the method :
<method>
def denormer(self, var) :
" denorme un vecteur d'entree "
try:
#a = map(self.decerner, self.param, var)
#a = [self.decerner(x, y) for x, y in map(None,
self.param, var)]
a = []
print 'in', None, self.param, var, len(self.param),
len(var), str(self.decerner)
#return map(undoc, self.param, var)
print map(None, var)
print map(None, self.param)
#print zip(var, var)
#print zip(self.param, self.param)
#print map(lambda x, y: (x,y), self.param, var)
#print zip(self.param, var)
b = []
print '$',
ii = range(len(var))
print ii, '$',
for i in ii :
print '%',
b.append((self.param[i], var[i]))
print b, '/',
print '$',
print b
for x,y in b :
print x, y
z = undoc(x, y)
print z
a.append(z)
except TypeError, c :
print 'E', str(self.decerner), self.param, var
print 'E2', str(c)
raise
return a
</method>
in fact the method was initially reduce to
<method>
return map(self.decerner, self.param, var)
</method>
all the commented line produced the same exception raised

this method unnormalize an input vector (var)

and the trace
<trace>
in None [(-2.0, 2.0), (-2.0, 2.0)] [0.1385039192456847,
0.87787941093093491] 2 2 <function undo at 0x81ff94c>
[0.1385039192456847, 0.87787941093093491]
[(-2.0, 2.0), (-2.0, 2.0)]
$ [0, 1] $ % [((-2.0, 2.0), 0.1385039192456847)] / % [((-2.0,
2.0), 0.1385039192456847), ((-2.0, 2.0), 0.87787941093093491)] / $
[((-2.0, 2.0), 0.1385039192456847), ((-2.0, 2.0),
0.87787941093093491)]
(-2.0, 2.0) 0.138503919246
% 0.277007838491
(-2.0, 2.0) 0.877879410931
% 1.75575882186
in None [(-2.0, 2.0), (-2.0, 2.0)] [0.38111874838950943,
0.74880175070169164] 2
2 <function undo at 0x81ff94c>
[0.38111874838950943, 0.74880175070169164]
[(-2.0, 2.0), (-2.0, 2.0)]
$ [0, 1] $ % [((-2.0, 2.0), 0.38111874838950943)] / % [((-2.0,
2.0), 0.38111874838950943), ((-2.0, 2.0), 0.74880175070169164)] /
E <function undo at 0x81ff94c>
[(-2.0, 2.0), (-2.0, 2.0)] [0.38111874838950943, 0.74880175070169164]
E2 bad argument type for built-in operation

[...]
</trace>

the first call of the methode succeed
all following call failed.

I've got different scenario which call this low level methode,
many succeed, some failed this way.

what's happened ?
If someone got an idea ?
what can raise this exception ?

My program is written partially in python and partially in C.
the top level is in python which call a C optimisation routine
which use a callback (PyObject_CallMethod) to evaluate the cost in
python again.
Jul 18 '05 #1
1 6486

Gilles Arnaud wrote:
Hello,

I've got a nasty bug and no idea to deal with :

here is the method :
Big snip. The Python code is unlikely to be your problem.
and the trace
<trace>
in None [(-2.0, 2.0), (-2.0, 2.0)] [0.1385039192456847,
0.87787941093093491] 2 2 <function undo at 0x81ff94c>
[0.1385039192456847, 0.87787941093093491]
That's a very mangled trace!
the first call of the methode succeed
all following call failed.
So the first call is leaving a bomb behind.

I've got different scenario which call this low level methode,
many succeed, some failed this way.

what's happened ?
If someone got an idea ?
what can raise this exception ?
At this stage, without the benefit of look-ahead, one could only blame
gamma rays or pointy-eared aliens :-)

My program is written partially in python and partially in C.
the top level is in python which call a C optimisation routine
which use a callback (PyObject_CallMethod) to evaluate the cost in
python again.


Aha! *Now* you tell us. *You* have "denormalised" the stack. Read your
C code carefully. Use a debugger, or put some "printf()" in it. With
PyObject_CallMethod, do the format descriptors and the arguments match?
Are you testing the returned value for NULL and acting accordingly? Is
the called-from-C Python method ever executed? Try putting a print
statement (that shows the args) at the top. More generally, are you
testing the returned value from each and every C API call? Are you
testing for the correct error value (some return NULL, some -1, ...)?
Are you doing the right thing on error?

A catalogue of the different ways of messing things up using C would
take forever to write. If you can't find your problem, post the code,
either on the newsgroup or as a web page.

Hope this helps,
John

Jul 18 '05 #2

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

Similar topics

1
by: Mark Sandfox | last post by:
Is there a way to restrict the user to only selecting and sending either a ..gif or .jpg. Everything I have read says this option can not be done by design (security reasons). I find that irronic...
2
by: David Reynolds | last post by:
Hi Everybody, I have a vb.net webform where I create the Excel application/workbook/worksheet. On Windows 2000 server for some reason, I keep getting an error("Bad variable type") when trying...
5
by: rod.weir | last post by:
Hello, I have the following code to iterate through each view in a SQL Server and call the "sp_refreshview" command against it. It works great until it finds a view that is damaged, or otherwise...
1
by: Java Guy | last post by:
I'm trying to view a web page. IE tells me there are (Java?) errors on the page. Here they are: Line: 15 Char: 7 Error: Wrong number of arguments or invalid propert assignment Code: 0 URL:...
1
by: jjelswick | last post by:
my daughter was sending pics of my grandaughters, i right clicked on them and saved them as a screensaver to look at daily(1st twin grandchildren) now i keep getting invalid argument error and...
4
by: robert | last post by:
On a server the binary (red hat) installed python2.4 and also a fresh compiled python2.5 spits "sem_post: Invalid argument". What is this and how can this solved? Robert ============== ...
0
by: gsauns | last post by:
I have a DetailsView which is inside of a FormView. I lifted this DetailsView straight off another one of my pages, where it was working beautifully. Now I get this endlessly frustrating error...
1
by: mato81 | last post by:
Hi all! I am a newbie to WSDL. I have a questions which has been driving me crazy... If I would have a WSDL with a types element somewhat like below, what is the point of the third last row...
6
by: James Yang | last post by:
"bad page", especially in table, is a risk for database maintenance. The particular access attempt for corrupt blocks may not occur often, and corrupt DB2 blocks are not recognized during a...
1
by: =?Utf-8?B?RWFnbGVSZWRASGlnaEZseWluZ0JpcmRzLmNvbQ== | last post by:
I have written a Web Service that works with my test harness written using VS2005. However, a client to the service consistently receives a "Bad Request (Invalid Header Name)" response for each...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.