Ex52- testing app.py


I am working on exercise 52, and the problem I am having is that I don’t know how to look at what is saved inside of the variables as the engine keeps moving forward in the app.py file.

I want to do this so I can see how the code and program are moving along.

For example, what the ‘room’ and ‘room_name’ variable values are once I am in a different room

    action = request.form.get('action')
    room = planisphere.load_room(room_name)
    next_room = room.go(action)
    if next_room == 'laser_weapon_armory':
        guesses = 0
        code = '123'
        invalid_sound = 'BZZZZEDD!'

        if action != code and guesses < 10:
            guesses += 1
            return render_template("show_room.html", room=room, invalid_sound=invalid_sound)

How can I assure and see that once I hit ‘tell a joke’ while inside ‘central_corridor’ my variable ‘next_room’ is now ‘laser_weapon_armory.’

Any help will be highly appreciated!

Yes, you can use the Python Debugger, pdb like this:


import pdb

Then, wherever you want the code to stop put:


And it will pause there and let you interact with it.

1 Like

This is exactly what I was looking for.

Thank you!

1 Like