apply problems

Curtis Jensen cjensen at bioeng.ucsd.edu
Mon Jul 16 20:16:55 CEST 2001


Thomas Wouters wrote:
> 
> On Fri, Jul 13, 2001 at 10:50:57AM -0700, Curtis Jensen wrote:
> > Python 1.5.2
> > Irix 6.5
> 
> > In my code, I have the line:
> > apply( self.ren.Elements, cmd[1], additional_kwds )
> >
> > and I get the error:
> > TypeError: keyword parameter redefined
> >
> >
> > where:
> > cmd[1] = [0, 0, 3, 3, 0.0, [0]]
> >
> > additional_kwds = {'prob': None, 'datum': None, 'elements':
> > <cont_classes.Elements.Elements instance at 103849c0>, 'nodes':
> > <cont_classes.Nodes.Nodes instance at 10384750>}
> 
> > def Elements( self, at, deformed, iact, normal, xi, nelist, nodes,
> > elements, *args, **kwds ):
> 
> Note: this function requires 9 arguments, one of which ('self') is passed
> implicitly when called through an instance. However, your error message
> 
> > If I remove the "additional_kwds" from the apply call, then I get:
> > TypeError: not enough arguments; expected 8, got 7
> 
> states otherwise. Conclusion: you're not using the code you say you are
> using :)
> 
> The error you're seeing, "keyword parameter redefined", should not occur
> given your code, and indeed I can't reproduce it. The 'keyword parameter
> redefined' error *does* happen if your 'additional_kwds' dictionary contains
> one of the 6 arguments you already pass in as positional arguments, though.
> 
> >
> > I can't figure out where the seventh argument is comming from. If I try:
> > "cmd[1][6]" I get:
> 
> The seventh argument in the error message is of course the implicit 'self'
> itself.
> 
> > I am unable to repeat this in a simple example, so I am forced to merely
> > describe the problem as best as I can.  The code is too big to post.
> 
> And *that*'s the biggest hint that you haven't described the real problem :)
> If you can't reproduce what you think is the error, it's probably not the
> real error.
> 
> --
> Thomas Wouters <thomas at xs4all.net>


I mispoke in my statement about the number of arguments.  It was the
"expected 8" arguments that was confusing me.  There should have been 9
as you say.

I am a little worried that the problem lies in one of our C modules.  It
core dumps sometimes.  I fear that it is writting to incorrect memory
address that is affecting Python.  I know that Python code is suppose to
be free of such memory problems, however that doesn't stop C code from
doing this.

-- 
Curtis Jensen
cjensen at bioeng.ucsd.edu
http://www-bioeng.ucsd.edu/~cjensen/
FAX (425) 740-1451



More information about the Python-list mailing list