473,604 Members | 2,487 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

"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.decern er, 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.decern er)
#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.decern er), self.param, var
print 'E2', str(c)
raise
return a
</method>
in fact the method was initially reduce to
<method>
return map(self.decern er, 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.1385039192456 847,
0.8778794109309 3491] 2 2 <function undo at 0x81ff94c>
[0.1385039192456 847, 0.8778794109309 3491]
[(-2.0, 2.0), (-2.0, 2.0)]
$ [0, 1] $ % [((-2.0, 2.0), 0.1385039192456 847)] / % [((-2.0,
2.0), 0.1385039192456 847), ((-2.0, 2.0), 0.8778794109309 3491)] / $
[((-2.0, 2.0), 0.1385039192456 847), ((-2.0, 2.0),
0.8778794109309 3491)]
(-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.3811187483895 0943,
0.7488017507016 9164] 2
2 <function undo at 0x81ff94c>
[0.3811187483895 0943, 0.7488017507016 9164]
[(-2.0, 2.0), (-2.0, 2.0)]
$ [0, 1] $ % [((-2.0, 2.0), 0.3811187483895 0943)] / % [((-2.0,
2.0), 0.3811187483895 0943), ((-2.0, 2.0), 0.7488017507016 9164)] /
E <function undo at 0x81ff94c>
[(-2.0, 2.0), (-2.0, 2.0)] [0.3811187483895 0943, 0.7488017507016 9164]
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_CallM ethod) to evaluate the cost in
python again.
Jul 18 '05 #1
1 6553

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.1385039192456 847,
0.8778794109309 3491] 2 2 <function undo at 0x81ff94c>
[0.1385039192456 847, 0.8778794109309 3491]
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_CallM ethod) to evaluate the cost in
python again.


Aha! *Now* you tell us. *You* have "denormalis ed" the stack. Read your
C code carefully. Use a debugger, or put some "printf()" in it. With
PyObject_CallMe thod, 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
3287
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 as this is the reason (security) that I want to restrict their selection. Any help on this one will be greatly appreciated. The page is using ASP.NET.
2
1914
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 to first set the value to a cell. I don't have the problem on 2003 server or XP, and I'm wondering if anyone knows of a get around on 2000? Try EApp = CreateObject("Excel.Application")
5
2666
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 cannot be refreshed. Then the whole routine stops working. Can someone please help me re-write this code so that any views that fail the "sp_refreshview" command get skipped. I'm sure it's just a matter of putting some basic error trapping...
1
8012
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: http://(address.of.my.webcam):port/LiveView.html and
1
2138
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 can't do it anymore can someone tell me what to do please........
4
3375
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 ============== server # python2.4 sem_post: Invalid argument
0
1525
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 message whenever I try to go into Edit mode: Specified argument was out of the range of valid values. Parameter name: index The DetailsView is actually inside an UpdatePanel, which is inside an Ajax Accordion, which is inside the FormView. Could...
1
12314
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 "<s:element name="string" nillable="true" type="s:string"/>". Why is it there and what is it for? ... <wsdl:types> <s:schema elementFormDefault="qualified" targetNamespace="http://www.home.NET"> <s:element name="GetWeather">
6
8007
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 database backup, corrupt blocks can remain undetected in an UDB system for a long time. The potential solution is: 1) Restore from a GOOD backup and rollforward (Recommended). The problem is backup normally is kept for 30 days so we must find the...
1
9528
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 request. He is using another development environment that requires that he create the actual request via multiple calls to a library to construct the request. I have sniffed the traffic from my harness program and the requests look like the...
0
7997
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7929
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8065
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8280
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6739
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5441
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3907
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2434
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1266
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.