[Zope] Missing objects do not support conversion to float

theeba theeba@centurysoftware.com.au
Fri, 29 Mar 2002 12:49:25 +0800


This is a multi-part message in MIME format.

------=_NextPart_000_00CC_01C1D720.27E79BE0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

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)) +=20
(string.atof(QuantityB) * string.atof(WeightB)) +=20
(string.atof(QuantityC) * string.atof(WeightC)) +=20
(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]=20

insert into table
 (Net_Weight)

 VALUES (<dtml-in sqlGetSackWeight><dtml-var =
expr=3D"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?=20

I hope you could help me solve this problem as soon as possible.

Thank you,

Theeba


------=_NextPart_000_00CC_01C1D720.27E79BE0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2919.6307" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi,</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I'm trying to&nbsp;insert a value which =
is computed=20
using python into a table. The python script looks as follows: =
-</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>import =
string<BR>return((string.atof(QuantityA) *=20
string.atof(WeightA)) + <BR>(string.atof(QuantityB) * =
string.atof(WeightB)) +=20
<BR>(string.atof(QuantityC) * string.atof(WeightC)) +=20
<BR>(string.atof(QuantityD) * string.atof(WeightD)))</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>The sql query to insert this value into =
the table=20
is as shown below: -</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>[Arguments : QuantityA, QuantityB, =
QuantityC,=20
QuantityD] </FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>insert=20
into&nbsp;table<BR>&nbsp;(Net_Weight)<BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;VALUES (&lt;dtml-in=20
sqlGetSackWeight&gt;&lt;dtml-var =
expr=3D"pyCalculateSackWeight(QuantityA, WeightA,=20
QuantityB, WeightB, QuantityC, WeightC, QuantityD,=20
WeightD)"&gt;&lt;/dtml-in&gt;)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>The sqlGetSackWeight is another sql =
query to=20
retrieve the value&nbsp;of WeightA, WeightB, WeightC and WeightD which =
is stored=20
in a separate table. These values would be multiplied by the value of =
the=20
arguments and the total is computed.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>The problem is, when I test the sql =
query to do an=20
insert, I get an error as shown below</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;<STRONG>Error Value: Missing =
objects do not=20
support conversion to float.</STRONG></FONT></DIV>
<DIV><BR><BR>&nbsp;&nbsp;&nbsp; (Info: ({'script': &lt;PythonScript =
instance at=20
08C40F00&gt;, 'context': &lt;r instance at 08EE1D40&gt;, 'container': =
&lt;Folder=20
instance at 08DD16D0&gt;, 'traverse_subpath': []}, ('1', Missing.Value, =
'2', 10,=20
'3', Missing.Value, '4', Missing.Value), {}, None))<BR>&nbsp; File =
Script=20
(Python), line 5, in pyCalculateSackWeight<BR>&nbsp; File=20
E:\Zope2.4.1-NEW\bin\lib\string.py, line 199, in atof<BR>TypeError: (see =

above)</DIV>
<DIV>&nbsp;</DIV>
<DIV>Why is it that the value for WeightA, WeightC and WeightD seems to =
be a=20
missing whereas, the value for WeightB (i.e 10) is inserted? </DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I hope you could help me solve this =
problem as soon=20
as possible.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Thank you,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Theeba<BR></DIV></FONT></BODY></HTML>

------=_NextPart_000_00CC_01C1D720.27E79BE0--