using
ubuntu linux
Python 2.4.3
mysql 5.0.22
mysqldb-1.2.2b1
SQLObject-0.8dev_r2019-py2.4.egg
I parse a utf-8 encoded xml file
with basic sax xcontent handler (parser):
s = open(fname).read()
sax.parseString(s, parser)
and SQLObjects are initiated from this data according to class definition
...
Title = UnicodeCol(dbName='Title', length=58, default=n) .
...
(other fields also UnicodeCol or int etc)
dbEncoding should be UTF8 , cause it's default, correct?
ok, BTW
connection_string = 'mysql://ebay:[EMAIL PROTECTED]/ebay_prod_77?debug=1&use_unicode=1&charset=utf8'
so here's the traceback, maybe you have an idea what to do?
1/QueryOne: SELECT COUNT(*) FROM active_item WHERE ((active_item.ItemID) = ('230037887117'))
1/QueryIns: INSERT INTO active_item (ItemID, TimeLeft, BidCount, Title, GalleryURL, CurrentPrice, NowAndNew, EndTime, CategoryId, Quantity) VALUES ('230037887117', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)
1/QueryOne: SELECT ItemID, Title, BidCount, TimeLeft, CurrentPrice, Quantity, EndTime, GalleryURL, NowAndNew, CategoryId FROM active_item WHERE id = (1)
1/Query : UPDATE active_item SET ItemID = ('230037887117'), TimeLeft = ('P4DT22H35M49S'), Title = ('A Day in the Life of the Soviet Union - Collins(publ.)'), GalleryURL = (' http://thumbs.ebaystatic.com/pict/2300378871176464.jpg'), CurrentPrice = (9.5), Quantity = (1) WHERE id = (1)
1/QueryOne: SELECT ItemID, Title, BidCount, TimeLeft, CurrentPrice, Quantity, EndTime, GalleryURL, NowAndNew, CategoryId FROM active_item WHERE id = (1)
1/QueryOne: SELECT COUNT(*) FROM active_item WHERE ((active_item.ItemID) = ('230037889640'))
1/QueryIns: INSERT INTO active_item (ItemID, TimeLeft, BidCount, Title, GalleryURL, CurrentPrice, NowAndNew, EndTime, CategoryId, Quantity) VALUES ('230037889640', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)
1/QueryOne: SELECT ItemID, Title, BidCount, TimeLeft, CurrentPrice, Quantity, EndTime, GalleryURL, NowAndNew, CategoryId FROM active_item WHERE id = (2)
Traceback (most recent call last):
File "EbayActiveListings.py ", line 105, in ?
test()
File "EbayActiveListings.py", line 103, in test
eal.parse_page(1)
File "EbayActiveListings.py", line 81, in parse_page
self.parseListing(self.fname )
File "EbayActiveListings.py", line 93, in parseListing
sax.parseString(s, parser)
File "/usr/lib/python2.4/site-packages/_xmlplus/sax/__init__.py", line 47, in parseString
parser.parse (inpsrc)
File "/usr/lib/python2.4/site-packages/_xmlplus/sax/expatreader.py", line 109, in parse
xmlreader.IncrementalParser.parse(self, source)
File "/usr/lib/python2.4/site-packages/_xmlplus/sax/xmlreader.py", line 123, in parse
self.feed(buffer)
File "/usr/lib/python2.4/site-packages/_xmlplus/sax/expatreader.py", line 216, in feed
self._parser.Parse(data, isFinal)
File "/usr/lib/python2.4/site-packages/_xmlplus/sax/expatreader.py", line 315, in end_element
self._cont_handler.endElement(name)
File "/var/www/localhost/htdocs/oebase/ebay/ItemParser.py", line 101, in endElement
setattr(self.ready, k, val)
File "<string>", line 1, in <lambda>
File "/usr/lib/python2.4/site-packages/SQLObject-0.8dev_r2019-py2.4.egg/sqlobject/main.py", line 1059, in _SO_setValue
value = to_python(dbValue, self._SO_validatorState)
File "/usr/lib/python2.4/site-packages/SQLObject- 0.8dev_r2019-py2.4.egg/sqlobject/col.py", line 548, in to_python
return unicode(value, self.db_encoding)
File "/usr/lib/python2.4/encodings/utf_8.py", line 16, in decode
return codecs.utf_8_decode (input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode bytes in position 31-33: invalid data
TIA
FLorian
------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________ sqlobject-discuss mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
