haha. web2py stores blobs base64 encoded. Your legacy database table has a blob (called 'data') and the data in there is not encoded. It happens that when you only extract record id=201326 this is not a problem because the blob field is empty.
This is another example of very new feature (support for legacy databases) that is being tested and you found a problem that needs to be addressed. There is not trivial solution since different databases handle blobs in different ways (which is why web2py normally base64 encodes them) and there are issues with escaping and encoding. If you do not need that column, I suggest use a sql view to eliminate it. If you do need it, you may try create a SQLCustomField. I will think a more general solution. Massimo On Dec 4, 3:52 pm, Benigno <bca...@albendas.com> wrote: > Hello, > After quite a lot of pain, I finally managed to install python- > mysqldb on my mac snow-leopard. At any rate it imports ok, and seems > to be working fine otherwise. > > Yet, something funny is going on, when I try to get a specific > record it seems to work fine: (as you can see legacy table has field > id) > > >>> a = db(db.eib_tele.id == 201326).select() > >>> a[0] > > <Row {'sernr': 'BT0100173211', 'src_addr': 4551, 'update_record': > <function <lambda> at 0x102a5aed8>, 'pid': 432L, 'ga1': 2318L, > 'last_time': datetime.datetime(2009, 10, 28, 17, 21, 22), 'ep_time': > 1256750473L, 'system_id': 0L, 'rt_counter': 6, 'tid': 196L, > 'src_type': 3, 'data': '', 'id': 201326L}> > > But If I try to get the table I get this error: > > >>> b = db(db.eib_tele.id > 0).select() > > Traceback (most recent call last): > File "<console>", line 1, in <module> > File "/Users/benigno/PyProjects/eibport/gluon/sql.py", line 2913, in > select > return self.parse(db,rows,self.colnames) > File "/Users/benigno/PyProjects/eibport/gluon/sql.py", line 2948, in > parse > colset[fieldname] = base64.b64decode(str(value)) > File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/ > python2.6/base64.py", line 76, in b64decode > raise TypeError(msg) > TypeError: Incorrect padding > > Anyone would know what may be going on or what I may be doing wrong? > > Thank in advance, > Benigno. -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.