Sunday, March 07, 2010

Added functions to betterbatch and debugging on the horizon

I was expecting function to be not so hard (just another way of
running a few steps) but it took a little bit of time all the same.

I got it implemented (though no tests for it yet) and it seems OK, I
will know better how it works when I get around to using it (hopefully
in the next week). Weekends for the tool and weekdays for using the
tool in production :)

With this addition I think the language definition is more or less
complete I think. I can imagine tweaking it a bit, fixing bugs etc,
but I don't expect to implement many other language constructs.

One of the next things that I am planning to implement is a simple
debugger (step through statements, print variable value, maybe change
variable values, etc). I was expecting this to be a fairly major
undertaking but again Python and it's community come to the rescue.
Right on cue

a) Catherine Devlin mentioned cmd2 on her blog,
which made me look at cmd in the Python standard library
b) I found the Python documentation a bit dry (or else I had very
little patience) so googled for some examples - and Doug Hellmann's
excellent PyMOTW (
if you don't know it - bookmark it!) popped up with some good examples
and great documentation.

I found that I was able to throw together a simple debugger (next,
print_var, print_vars, etc)

So this means that a debugger is really easy to write - and is a much smaller task than I was hoping. Maybe next weekend I get the debugger implementation finished.

Tuesday, March 02, 2010

BetterBatch released

I have released BetterBatch (
and I would like more people to know about it.

I created it as something that I could use at work. We have many tasks
that require adhoc automations which may have different people running
them. These automations may not have a very long life so it often
doesn't make sense to write it up as Python/Perl script. This work is
done on Windows machines so not many of us (me included) do not have a
lot of experience with shell scripting. Even if we did - shell
scripting wouldn't necessarily be the ideal candidate.

So it was designed as a batch file replacement with some improvements:
Some requirements I had while making this:

  • output from commands can be assigned to variables
  • it needs to be just as easy to call external applications as a batch file
  • all actions should be logged
  • the return value of everything should be checked (and stop the script on error!)
  • it should be prettier than a batch file

I have not tested this on any *nix style machine yet - but believe it
should work (meaning that it probably won't work at first - but I am
hoping that minimal changes will make it work)

Give it a try (please :) )
Log an issue: