[Zope] Missing objects do not support conversion to float
kapil thangavelu
kthangavelu@earthlink.net
Fri, 29 Mar 2002 14:26:24 -0800
On Thursday 28 March 2002 08:49 pm, theeba wrote:
> Hi,
>
> I'm trying to insert a value which is computed using python into a table.
> The python script looks as follows: -
>
> import string
> return((string.atof(QuantityA) * string.atof(WeightA)) +
> (string.atof(QuantityB) * string.atof(WeightB)) +
> (string.atof(QuantityC) * string.atof(WeightC)) +
> (string.atof(QuantityD) * string.atof(WeightD)))
>
> The sql query to insert this value into the table is as shown below: -
>
> [Arguments : QuantityA, QuantityB, QuantityC, QuantityD]
>
> insert into table
> (Net_Weight)
>
> VALUES (<dtml-in sqlGetSackWeight><dtml-var
> expr="pyCalculateSackWeight(QuantityA, WeightA, QuantityB, WeightB,
> QuantityC, WeightC, QuantityD, WeightD)"></dtml-in>)
>
> The sqlGetSackWeight is another sql query to retrieve the value of WeightA,
> WeightB, WeightC and WeightD which is stored in a separate table. These
> values would be multiplied by the value of the arguments and the total is
> computed.
>
> The problem is, when I test the sql query to do an insert, I get an error
> as shown below
>
> Error Value: Missing objects do not support conversion to float.
>
>
> (Info: ({'script': <PythonScript instance at 08C40F00>, 'context': <r
> instance at 08EE1D40>, 'container': <Folder instance at 08DD16D0>,
> 'traverse_subpath': []}, ('1', Missing.Value, '2', 10, '3', Missing.Value,
> '4', Missing.Value), {}, None)) File Script (Python), line 5, in
> pyCalculateSackWeight
> File E:\Zope2.4.1-NEW\bin\lib\string.py, line 199, in atof
> TypeError: (see above)
>
> Why is it that the value for WeightA, WeightC and WeightD seems to be a
> missing whereas, the value for WeightB (i.e 10) is inserted?
not exactly sure, sql methods operate in a slightly different namespace,
quoting out of context from DT_Var.py re Missing
'Missing values are provided for variables which are not
present in the name space'
how are you calling the sql method, have you tried explictly passing the
parameters??
kapil