Exemplo n.º 1
0
# errors.py
#
# test printing tracebacks from exceptions when an error occurs
# should continue running mqtt loop, but print traceback

from arena import Scene

scene = Scene(host="arena.andrew.cmu.edu", realm="realm", scene="example")


@scene.run_once
def main():
    print("hello")
    print(1 / 0)  # should print traceback here!
    print("world")


@scene.run_forever
def forever():
    print("goodbye")
    print(iDontExist()
          )  # should print traceback here and stop running this task!
    print("planet")


scene.run_tasks()
Exemplo n.º 2
0
# errors.py
#
# test printing tracebacks from exceptions when an error occurs
# should continue running mqtt loop, but print traceback

from arena import Scene

scene = Scene(host="arenaxr.org", scene="example")


@scene.run_once
def main():
    print("hello")
    print(1 / 0)  # should print traceback here!
    print("world")


@scene.run_forever
def forever():
    print("goodbye")
    print(iDontExist()
          )  # should print traceback here and stop running this task!
    print("planet")


scene.run_tasks()
Exemplo n.º 3
0
                USERS[camname].set_textright(USERS[camname].typetext)


def end_program_callback(_scene):
    for camname in USERS:
        USERS[camname].delete()
    show_redpill_scene(False)
    # TODO: remove origin marker
    for objid in CONTROLS:
        for ctrl in CONTROLS[objid]:
            _scene.delete_object(CONTROLS[objid][ctrl])


# parse args and wait for events
init_args()
random.seed()
kwargs = {}
if PORT:
    kwargs["port"] = PORT
if NAMESPACE:
    kwargs["namespace"] = NAMESPACE
if DEBUG:
    kwargs["debug"] = DEBUG
scene = Scene(host=BROKER,
              realm=REALM,
              scene=SCENE,
              on_msg_callback=scene_callback,
              end_program_callback=end_program_callback,
              **kwargs)
scene.run_tasks()
Exemplo n.º 4
0
# errors.py
#
# test printing tracebacks from exceptions when an error occurs
# should continue running mqtt loop, but print traceback

from arena import Scene


scene = Scene(host="arenaxr.org", realm="realm", scene="example")


@scene.run_once
def main():
    print("hello")
    print(1/0)      # should print traceback here!
    print("world")

@scene.run_forever
def forever():
    print("goodbye")
    print(iDontExist())     # should print traceback here and stop running this task!
    print("planet")


scene.run_tasks()