本文整理汇总了Python中app.Application.run方法的典型用法代码示例。如果您正苦于以下问题:Python Application.run方法的具体用法?Python Application.run怎么用?Python Application.run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app.Application
的用法示例。
在下文中一共展示了Application.run方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from app import Application [as 别名]
# 或者: from app.Application import run [as 别名]
def main():
app = Application(args=docopt(__doc__))
config = app.load_config(DataTakerConfiguration)
app.run(decoder=DataTakerDecoder,
data_handlers=(DataTakerDataStorer(config.store_dir,
config.backup_dir),),
connection_handlers=((DataTakerConnectionHandler(config.cmd_file)),))
示例2: main
# 需要导入模块: from app import Application [as 别名]
# 或者: from app.Application import run [as 别名]
def main():
app = Application(args=docopt(__doc__))
config = app.load_config(AethalometerConfiguration)
app.run(decoder=AethalometerDecoder,
data_handlers=(AethalometerDataStorer(config.store_dir,
config.backup_dir),),
connection_handlers=())
示例3: main
# 需要导入模块: from app import Application [as 别名]
# 或者: from app.Application import run [as 别名]
def main():
setup = Setup()
config = setup.run()
app = Application(config)
app.run()
teardown = Teardown()
teardown.run()
示例4: main
# 需要导入模块: from app import Application [as 别名]
# 或者: from app.Application import run [as 别名]
def main():
# initialize pygame
pygame.init()
pygame.display.set_mode((800, 600))
# create game
app = Application(Instruction)
try:
app.run()
except KeyboardInterrupt:
app.quit()
示例5: main
# 需要导入模块: from app import Application [as 别名]
# 或者: from app.Application import run [as 别名]
def main():
# initialize pygame
pygame.init()
screen = pygame.display.set_mode((800, 800))
pygame.display.set_caption("Super Coin Get")
app = Application(screen)
app.set_state(GameState)
# create game
try:
app.run()
except KeyboardInterrupt:
app.quit()
示例6: demo_main
# 需要导入模块: from app import Application [as 别名]
# 或者: from app.Application import run [as 别名]
def demo_main():
script_basename = "youpinitel-demo"
cfg_home = "/etc" if os.getuid() == 0 else ".youpinitel"
parser = argparse.ArgumentParser(description="Youpi + Minitel demonstration")
parser.add_argument(
"-m",
"--minitel-port",
help="device to which the Minitel is connected (default: %(default)s)",
dest="minitel_port",
default="/dev/ttyUSB0",
)
parser.add_argument("-p", "--arm-port", help="device to which the arm interface is connected", dest="arm_port")
parser.add_argument("-b", "--arm-busname", help="nROS bus name of the arm controller", dest="arm_busname")
parser.add_argument(
"-c",
"--config-file",
help="configuration file (default: %(default)s)",
dest="config_file",
type=file,
default=os.path.join(cfg_home, "%s.json" % script_basename),
)
parser.add_argument("-d", "--debug", help="activates debug trace", action="store_true")
args = parser.parse_args()
try:
app = Application(log=logging.getLogger("app"), **args.__dict__)
except Exception as e:
if args.debug:
logging.exception("unexpected error")
logging.getLogger().fatal("unable to initialize application instance (%s)", e)
else:
try:
app.run()
except Exception as e:
if args.debug:
logging.exception("unexpected error")
else:
# logging.getLogger().fatal('unexpected error : (%s) %s', e.__class__.__name__, e)
logging.getLogger().exception(e)
else:
logging.getLogger().info("application terminated")
示例7: main
# 需要导入模块: from app import Application [as 别名]
# 或者: from app.Application import run [as 别名]
def main():
# initialize pygame
pygame.init()
screen = pygame.display.set_mode((600, 600))
app = Application(Game)
try:
app.run()
except KeyboardInterrupt:
app.quit()
screen = pygame.display.set_mode((800, 800))
# create game
game = Game(screen)
try:
game.run()
except KeyboardInterrupt:
game.quit()
示例8: run
# 需要导入模块: from app import Application [as 别名]
# 或者: from app.Application import run [as 别名]
def run(args):
try:
app = Application(args.path)
app.run()
except IOError as e:
print("error: failed to open file \"%s\"" % args.path)
示例9: Application
# 需要导入模块: from app import Application [as 别名]
# 或者: from app.Application import run [as 别名]
import sys
from app import Application
import logging
import scavenger
if __name__ == "__main__":
# Set up logging.
if '-d' in sys.argv:
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s - %(levelname)s: %(message)s\n'\
'\t%(filename)s, %(funcName)s, %(lineno)s',
datefmt='%m/%d/%y %H:%M:%S')
else:
logging.basicConfig(level=logging.ERROR,
format='%(asctime)s - %(levelname)s: %(message)s',
datefmt='%m/%d/%y %H:%M:%S')
# Start the application.
try:
app = Application(sys.argv)
except Exception, e:
logging.getLogger('Main').error('Exception raised in main thread.', exc_info=True)
sys.exit(1)
rc = app.run()
scavenger.shutdown()
sys.exit(rc)