Logs and crash files

Python · Updated 09 November 2026

Where your script's output goes, and what a crash file tells you.

Log with ctx.log

Use ctx.log rather than print:

def on_loop(self) -> int:
    self.ctx.log.debug("checking bank at %s", tile)
    self.ctx.log.warn("no food left")

It has debug, info, warn, error and exception, with %s-style arguments like the standard logging module.

Run logs

Under bwu_host, every run of a script writes one file under:

~/.botwithus/logs/scripts/<script-slug>/
  • It holds everything at DEBUG and above, whatever the console shows: ctx.log, the standard logging module, and print / sys.stderr from the script's thread.
  • It is redacted before it reaches disk: account and character names, emails, tokens, IP addresses and your user folder are removed. Even so, read a run log before you share it.
  • Threads your script starts itself are not attributed to its run.
  • Old files are cleaned up automatically. The newest 20 runs per script are kept.

Crash files

When a script stops on an error, its run log ends with a crash block:

  • the phase it failed in: on_start, on_loop (with the loop number) or on_stop;
  • the full traceback;
  • the innermost frame in your code;
  • the last 200 host calls the script made.

Start with "the innermost frame in your code". It points at the line that failed even when the traceback goes deep into the framework.

Common problems

Symptom Cause
The script is missing from the GUI list The file defines two BotScript classes, or raises on import.
no game client found No client is running with BotWithUs attached.
The script runs far too fast It paces on game_cycle or publish_seq. Use ctx.sleep_ticks.
Stopping takes 10 seconds, then the process ends The script waits in time.sleep or a long loop that never checks ctx.stopping.
PathError mentioning not in game A walk started without a tile. Check ctx.self_player.has_tile first.