On Monday, April 30, 2018 at 9:04:57 PM UTC-7, Maurice Waka wrote: > > Now another error :invalid syntax: random _number = > random.randrange(0,rows.count()) > > Is the typo just in your post, or in the code you are trying? (Remove space between "random" and "_number").
/dps On Tue, 1 May 2018, 06:55 pbreit <pbreit...@gmail.com <javascript:>> wrote: > >> Very sorry. Try: >> >> random_number = random.randrange(0, len(rows)) >> >> >> >> On Monday, April 30, 2018 at 8:03:45 PM UTC-7, Maurice Waka wrote: >>> >>> I get this error : AttributeError: 'Rows' object has no attribute >>> 'count' >>> >>> On Mon, 30 Apr 2018, 22:10 pbreit <pbreit...@gmail.com> wrote: >>> >>>> I would think something like: >>>> >>>> rows = db(db.person.id>0).select() >>>> random_number = random.randrange(0, rows.count()) >>>> row = rows[random_number] >>>> return row >>>> >>>> -- >>>> 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 a topic in the >>>> Google Groups "web2py-users" group. >>>> To unsubscribe from this topic, visit >>>> https://groups.google.com/d/topic/web2py/ynBOuIdufso/unsubscribe. >>>> To unsubscribe from this group and all its topics, send an email to >>>> web2py+un...@googlegroups.com. >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> -- >> 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 a topic in the >> Google Groups "web2py-users" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/web2py/ynBOuIdufso/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> web2py+un...@googlegroups.com <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > -- 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.