Closed GoogleCodeExporter closed 8 years ago
hi henk-jan,
this does not work...
Traceback (most recent call last):
File "D:\python27\lib\site-packages\bots\engine.py", line 204, in start
botslib.runscript(userscript,scriptname,'postnewrun',routestorun)
TypeError: runscript() takes exactly 3 arguments (4 given)
should be...
botslib.runscript(userscript,scriptname,'postnewrun',routestorun=routestorun)
Also I have added 'postrun' for a user exit after any type of run. I will use
this for my own custom error reporting by reading the log.
botslib.remove_database_lock()
if userscript and hasattr(userscript,'postrun'):
botslib.runscript(userscript,scriptname,'postrun',routestorun=routestorun,commandstorun=commandstorun)
You have coded the userscript name as botsengine.py, not bots-engine.py as
stated above.
Kind Regards,
Mike
Original comment by mjg1964
on 15 Sep 2011 at 12:43
Attachments:
It might also be useful to add postcleanup, postretry etc.
Original comment by mjg1964
on 15 Sep 2011 at 7:14
hi Mike,
I will take a look at this.
it works here with userscriptfile 'botsengine.py' in routescripts and:
def postnewrun(routestorun):
actually, what this is about:
I run a testservice for DESADV (send a email with desadv version D01b to
easydesadv@gmail.com, you'll get a report back)
how it works:
- not a real mapping, the the 'rules' in the MIG are checked (in the
Netherlands, we have a lot of rules). The mapping generates a email report.
- but in case of edifct errors, the mapping is never reached.
- so instead the userscript, which fetches all errors for the run, and
formats these into a report.
Original comment by hjebb...@gmail.com
on 15 Sep 2011 at 8:19
Original comment by hjebb...@gmail.com
on 28 Oct 2011 at 7:07
Hi henk-jan,
I looked at this again, this was new python syntax for me. Found a good
explanation here
http://www.saltycrane.com/blog/2008/01/how-to-use-args-and-kwargs-in-python/
botslib.runscript uses **argv keyword arguments, therefore engine.py must use
routestorun=routestorun. Not sure how it can work otherwise?
I am using the extra "postrun" exit point I added for some extra processing of
log files after any type of run.
Kind Regards,
Mike
Original comment by mjg1964
on 1 Nov 2011 at 11:14
hi Mike,
yes, I think you are right.
I looked at my code, seems I am not using this parameter in my set-up, so I did
not notice.
thank you!
henk-jan
Original comment by hjebb...@gmail.com
on 1 Nov 2011 at 12:08
I have tried this out, works ok for me. One thing to beware of, any exception
in this userscript will cause bots engine to fail without any trace of errors
in the log or GUI and the database is left locked. So perhaps some error
checking is needed, or at least document this warning?
Kind Regards,
Mike
Original comment by mjg1964
on 8 Nov 2011 at 9:05
Original comment by hjebb...@gmail.com
on 10 Sep 2013 at 12:44
Original issue reported on code.google.com by
hjebb...@gmail.com
on 28 Mar 2011 at 10:27