Just set:

migrate=False

so it doesn't try to recreate the table

from gluon.scheduler import Scheduler scheduler =
Scheduler(db,tasks=dict(our_function=f), migrate=False)

On Wed, May 20, 2015 at 9:25 PM, Aydin S <[email protected]> wrote:

> When I try to create a new model in web2py for scheduller I get an error.
> The model is as follows
>
> `def f():
>     a = 2
>     return ()
>
> from gluon.scheduler import Scheduler scheduler =
> Scheduler(db,dict(our_function=f))
>
> I get the following error:
>
> `
>
> Traceback (most recent call last):
>  File "/home/www-data/web2py/gluon/restricted.py", line 227, in restricted
>  exec ccode in environment
>  File "/home/www-data/web2py/applications/Home_Lights/models/mtasks.py", line 
>             `42, in <module>`
>  Scheduler(db,dict(our_function=f))
>  File "/home/www-data/web2py/gluon/scheduler.py", line 587, in __init__
>  self.define_tables(db, migrate=migrate)
>  File "/home/www-data/web2py/gluon/scheduler.py", line 655, in define_tables
>  format='%(task_name)s')
>  File "/home/www-data/web2py/gluon/packages/dal/pydal/base.py", line 799, in  
> `define_table`
>  raise SyntaxError('table already defined: %s' % tablename)
>
>     SyntaxError: table already defined: scheduler_task`
>
> I suspect it has to do with the execution permission of the newly created
> model. any help is appreciated...?
>
> --
> 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.
>



-- 
Massimiliano

-- 
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.

Reply via email to