I'm sorry it's always the simplest explanation!!
Il giorno lunedì 3 agosto 2015 17:19:45 UTC+2, Niphlod ha scritto:
>
> you NEED db.commit() (not commiNt()) in the scheduler function.
>
> On Monday, August 3, 2015 at 2:20:24 PM UTC+2, Lisandro wrote:
>>
>> Look for the traceback information in the table scheduler_run. If the
>> function fails, there will be a record in that table showing some detail
>> about the error. Post that traceback here so we can figure it out where is
>> the error.
>>
>> Also, make sure you instantiate Scheduler() with migrate=True at least
>> one time, in order to let web2py create the tables needed by the Scheduler.
>>
>> El lunes, 3 de agosto de 2015, 6:40:28 (UTC-3), Paolo Amboni escribió:
>>>
>>>
>>> i can't understand why this scheduled task always fails.
>>> *It sems something related to the command commit().*
>>> But without it no changes are saved in the db.
>>> The same function without the commit command works fine in a controller
>>> The code is the following:
>>>
>>> db.py
>>> db.define_table('test',
>>> Field('tempo','datetime',default=request.now),
>>> Field('nome','string')
>>> )
>>>
>>> scheduler,py
>>> def func1():
>>> db.test.insert(nome='func1')
>>> db.commint()
>>>
>>> from gluon.scheduler import Scheduler
>>> import datetime
>>> scheduler= Scheduler(db,tasks=dict(test1=func1))
>>>
>>
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.