[Python-au] String Problem

Graeme Matthew graeme_matthew@hotmail.com
Thu, 23 Jan 2003 22:23:44 +1100


Hi all im busy parsing an Order xml file and building an SQL string
but keep getting this error only on the deliveryDate

Traceback (most recent call last):
  File "<pyshell#74>", line 1, in ?
    mb.delegateMessage()
  File "C:/BIS/classes\MessageBroker.py", line 62, in delegateMessage
    op.processOrders()
  File "C:/BIS/classes\OrderProcessor.py", line 56, in processOrders
    #vals = vals + self.__getElementValue(order,'deliveryDate') + ","
TypeError: coercing to Unicode: need string or buffer, NoneType found

Heres a sample of the xml

<instructions>Deliver before 7.00am</instructions>
<jobNo>R5555</jobNo>
<costCentre>Framing</costCentre>
<loadNo>2222X</loadNo>
<orderDate>16/01/2003</orderDate>
<deliveryDate>20/01/2003</deliveryDate>
<oTimestamp>16/01/2003 14:00:25</oTimestamp>


biOrderId = self.__getElementValue(order,'biOrderId')
vals = biOrderId + ","
vals = vals + self.__getElementValue(order,'orderId') + ","
vals = vals + self.__getElementValue(order,'invoiceAddress') + ","
vals = vals + self.__getElementValue(order,'deliveryAddress') + ","
vals = vals + self.__getElementValue(order,'instructions') + ","
vals = vals + self.__getElementValue(order,'jobNo') + ","
vals = vals + self.__getElementValue(order,'costCentre') + ","
vals = vals + self.__getElementValue(order,'loadNo') + ","
vals = vals + self.__getElementValue(order,'orderDate') + ","
vals = vals + self.__getElementValue(order,'deliveryDate') + ","
vals = vals + self.__getElementValue(order,'oTimeStamp') + ","
print vals
** do not fear sql characters for field wraps will come later :-)

any ideas would be nice

tks

Graeme


_________________________________________________________________
MSN 8 with e-mail virus protection service: 2 months FREE*  
http://join.msn.com/?page=features/virus