Actually, the 'code' variable catches the exit code, when using sys.exit(code). I don't really need it there now so it will go away, but it definitely works :)