can you try add

db.commit()

This is not necessary for normal controllers but perhaps it is
necessary for Cron.
@Achipa, could you clarify this aspect of cron?

Massimo

On Apr 3, 7:45 pm, seth <seth.le...@gmail.com> wrote:
> Hi Massimo,
>
> Thanks for the quick response. I've since tried the same on another
> machine (this time ubuntu linux) and am having the same trouble, this
> time there is no dbhash error.
>
> In case anyone wants to verify my troubles, here are the relevant
> parts...
>
> [web2py crontab] /applications/cronworks/cron/crontab
>      */1        *       *       *       *       root *default/crontest
>
> [External crontab] crontab -e
>     0-59/1 * * * * cd /home/seth/web2py && python web2py.py -M -R
> applications/cronworks/controllers/default.py -C -D 1 >> /tmp/
> cronworks.output 2>&1
>     I've tried with and without the -M and -R
>
> [Model] db.py
>
>   db.define_table('cron',
>     db.Field('word', 'string'))
>
> [Controller] default.py - crontest()
>
>   def crontest():
>       print "INSIDE CRONTEST"
>       db.cron.insert(word='thisisatest')
>
> As with before, I can verify that the method is being run every
> minute, and that the insert works when the method is called via the
> url.
>
> [cronworks.output]
>   INFO:root:Hard cron daemon started
>   DEBUG:root:External cron invocation
>   DEBUG:root:WEB2PY CRON: Trying to acquire lock
>   DEBUG:root:WEB2PY CRON: Locked
>   INFO:root:WEB2PY CRON (ext): Application: cronworks executing
> *default/crontest in /home/seth/web2py at 2009-04-04 00:35:02.115734
>   DEBUG:root:WEB2PY CRON: Releasing cron lock
>   DEBUG:root:WEB2PY CRON done
>   INFO:root:WEB2PY CRON Call returned: default applications appear to
> be installed already
>   web2py Enterprise Web Framework
>   Created by Massimo Di Pierro, Copyright 2007-2009
>   Version 1.59 (2009-03-16 13:10:16)
>   Database drivers available: SQLite3
>   INSIDE CRONTEST
>   None
>
> Thank you kindly for your time, and keep up the great work with
> web2py!
>
> Cheers.
> -Seth
>
> On Apr 2, 5:06 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > I do not know if this is related but sqlite that ships on python for
> > macosx has known bugs. This would not be the only one. You should use
> > the binary distribution on OSX which does not seem to have these
> > problems.
>
> > On Apr 2, 6:29 pm, seth <seth.le...@gmail.com> wrote:
>
> > > I'm having trouble doing a db.table.insert from an external cron on
> > > macosx.
>
> > > The system cron file
>
> > > 0-59/1 * * * * cd /Users/username/Desktop/appname/web2py && python
> > > web2py.py -R applications/appname/controllers/test.py -C -D 1 >> /tmp/
> > > cron.output 2>&1
>
> > > The crontab file in appname/cron directory
>
> > > */10    *       *       *       *       root *test/callcron
>
> > > I can see the callcron method is successfully being called every ten
> > > minutes from the cron.output file.
>
> > > But, in cron.output I get the following error
> > > WARNING:root:unable to import dbhash
>
> > > and none of the db.table.inserts put anything in the database.
> > > Although, when I hit the controller/action via the URL everything
> > > works fine and I get entries in the database.
>
> > > I've also tried the -S appname and -M switches, with no changes.
>
> > > I've followed the following posts
>
> > >http://groups.google.com/group/web2py/browse_thread/thread/cfe89bfa9d...
>
> > > and
>
> > >http://groups.google.com/group/web2py/browse_thread/thread/9acf0aae73...
>
> > > with the same results.
>
> > > I'm new to web2py so I may be missing something obvious :)
>
> > > Thanks in advance,
> > > -Seth
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@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
-~----------~----~----~----~------~----~------~--~---

Reply via email to