an integer can't be ''. set them to null of to 0 at import time :D On Wednesday, June 24, 2015 at 7:28:21 PM UTC+2, goome wrote: > > Hello > i have a table with integer field. > i populated thhe db from a csv (created from other then me). > it sometimes has empty value for the integers fields. > So when i try to get a list of the records of the table, i got: > type 'exceptions.ValueError'> invalid literal for long() with base 10: '' > > from db.py #table prodotti > Field("lunghezza","integer"), > Field("larghezza","integer"), > > from default.py > prodotti = legacy_db().select(legacy_db.prodotti.ALL,orderby='prodotti.id > DESC', limitby=limitby) > > The error ticket: > File > "/home/marcello/scripts/web2py/2/web2py/applications/PROVE/controllers/default.py", > > line 171, in lista_prodotti > prodotti = legacy_db().select(legacy_db.prodotti.ALL,orderby=' > prodotti.id DESC', limitby=limitby) > File > "/home/marcello/scripts/web2py/2/web2py/gluon/packages/dal/pydal/objects.py", > line 2026, in select > return adapter.select(self.query,fields,attributes) > File > "/home/marcello/scripts/web2py/2/web2py/gluon/packages/dal/pydal/adapters/sqlite.py", > > line 125, in select > return super(SQLiteAdapter, self).select(query, fields, attributes) > File > "/home/marcello/scripts/web2py/2/web2py/gluon/packages/dal/pydal/adapters/base.py", > > line 1239, in select > return self._select_aux(sql,fields,attributes) > File > "/home/marcello/scripts/web2py/2/web2py/gluon/packages/dal/pydal/adapters/base.py", > > line 1220, in _select_aux > return processor(rows,fields,self._colnames,cacheable=cacheable) > File > "/home/marcello/scripts/web2py/2/web2py/gluon/packages/dal/pydal/adapters/base.py", > > line 1596, in parse > value = self.parse_value(value,ft,blob_decode) > File > "/home/marcello/scripts/web2py/2/web2py/gluon/packages/dal/pydal/adapters/base.py", > > line 1450, in parse_value > return self.parsemap[key](value,field_type) > File > "/home/marcello/scripts/web2py/2/web2py/gluon/packages/dal/pydal/adapters/base.py", > > line 1534, in parse_integer > return long(value) > ValueError: invalid literal for long() with base 10: '' > > how to face with empty values? > >
-- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.