I confirm this, the book is wrong, someone can change it?. http://web2py.com/books/default/chapter/29/4#Scheduler-(experimental)
2012/2/6 Jim Steil <[email protected]> > That did it. Thanks! > > How do we go about getting the book updated? Page 195 is showing the > syntax I was using. > > -Jim > > > On 2/6/2012 4:18 PM, Martín Mulone wrote: > > Yes I think the json format is strict to " instead of ' > > change with this and try again: > > > vars='{"fromDate":"2012-01-01","toDate":"2012-01-31","districtNumber":0}', > > 2012/2/6 Jim Steil <[email protected]> > >> Hi >> >> I'm having trouble getting my vars json string right on my call to add a >> job to my scheduler. If I run with no vars, it works fine. But, when I >> add my json string I'm getting: >> >> Traceback (most recent call last): >> File "C:\dev\web2py\gluon\scheduler.py", line 159, in executor >> vars = loads(task.vars, object_hook=_decode_dict) >> File "C:\dev\web2py\gluon\contrib\simplejson\__init__.py", line 403, in >> loads >> return cls(encoding=encoding, **kw).decode(s) >> File "C:\dev\web2py\gluon\contrib\simplejson\decoder.py", line 403, in >> decode >> obj, end = self.raw_decode(s, idx=_w(s, 0).end()) >> File "C:\dev\web2py\gluon\contrib\simplejson\decoder.py", line 419, in >> raw_decode >> obj, end = self.scan_once(s, idx) >> File "C:\dev\web2py\gluon\contrib\simplejson\scanner.py", line 72, in >> scan_once >> return _scan_once(string, idx) >> File "C:\dev\web2py\gluon\contrib\simplejson\scanner.py", line 43, in >> _scan_once >> _scan_once, object_hook, object_pairs_hook, memo) >> File "C:\dev\web2py\gluon\contrib\simplejson\decoder.py", line 207, in >> JSONObject >> raise JSONDecodeError("Expecting property name", s, end) >> JSONDecodeError: Expecting property name: line 1 column 1 (char 1) >> >> My add_task looks like this: >> >> db.scheduler_task.insert( >> status='QUEUED', >> application_name='myApp', >> task_name='Task name', >> function_name='functionname', >> args='[]', >> >> vars="{'fromDate':'2012-01-01','toDate':'2012-01-31','districtNumber':0}", >> enabled=True, >> start_time=request.now, >> stop_time=request.now+datetime.timedelta(days=1), >> repeats=1, >> timeout=600) >> >> is there something obvious I'm doing wrong? >> >> -Jim >> >> > > > -- > http://www.tecnodoc.com.ar > > -- http://www.tecnodoc.com.ar

