def with_daemon_session(self, f): if not have_cl2: appuifw.note(u"CL2 client lib not installed", "error") return try: session = cl2_client.Session() except: appuifw.note(u"Failed to connect to CL2", "error") return try: return f(session) finally: session.close()
def __init__(self): self.lock = e32.Ao_lock() self.main_title = u"CL2 Repl" self.old_title = appuifw.app.title app_path = os.path.split(appuifw.app.full_name())[0] self.app_drive = app_path[:2] main_menu = [(u"Eval", self.ask), (u"Exit", self.abort)] appuifw.app.title = self.main_title appuifw.app.menu = main_menu appuifw.app.exit_key_handler = self.abort self.session = cl2_client.Session() self.code = u""
import cl2_client session = cl2_client.Session() try: print "len is %d" % session.des16_len(u"four") finally: session.close() print "all done"