当前位置: 首页>>代码示例>>Python>>正文


Python Shell.cmdloop方法代码示例

本文整理汇总了Python中shell.Shell.cmdloop方法的典型用法代码示例。如果您正苦于以下问题:Python Shell.cmdloop方法的具体用法?Python Shell.cmdloop怎么用?Python Shell.cmdloop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在shell.Shell的用法示例。


在下文中一共展示了Shell.cmdloop方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: handle

# 需要导入模块: from shell import Shell [as 别名]
# 或者: from shell.Shell import cmdloop [as 别名]
    def handle(self):
        logger.debug("Connected from %s %u" %(self.client_address))
#        try:
        exit=False
        shellmode=False
        logger.debug("Starting a shell")
        from shell import Shell
        myshell=Shell(self.rfile, self.wfile, self.server.user, self.server.passwd)
        try:
            myshell.cmdloop()
        except:
            ComLog.errorTraceLog(logger)
#        except SSL.ZeroReturnError:
#            pass
        self.request.close()
        logger.debug("Disconnected from %s %u" %(self.client_address))
开发者ID:Open-Sharedroot,项目名称:Open-Sharedroot-initrd-ng,代码行数:18,代码来源:fence_ack_server.py

示例2: _handle

# 需要导入模块: from shell import Shell [as 别名]
# 或者: from shell.Shell import cmdloop [as 别名]
    def _handle(self, file):
        try:
            mp3 = MP3(file)
        except MP3NoID3:
            # Skip because no ID3 tag found
            print u"\n" + u'"' + file + '" skipped because no ID3 tag found.'
            return
            
        if mp3.is_processed():
            # Skip already processed MP3s
            # TODO: Add command line switch to ignore this and process anyway!
            print u"\n" + u'"' + mp3.get_title() + u'" by "' + mp3.get_artist() + '" has already been processed.'
            return
        
        tag_manager = TagManager(
                self._config,
                [ 
                    LastFMProvider(self._config, mp3),
                    FreebaseProvider(self._config, mp3),
                ]
        )
        tag_manager.retrieve()

        if tag_manager.has_unmapped_tags():
            cmd = Shell(self._config, mp3, tag_manager)
            cmd.cmdloop(
                u'Unmapped tags mapped for "' + mp3.get_title() + u'" by "' + mp3.get_artist() + u'"'
            )

        if len(tag_manager.get_tags()) == 0:
            cmd = Shell(self._config, mp3, tag_manager)
            cmd.cmdloop(
                u'No fitting tags found for "' + mp3.get_title() + u'" by "' + mp3.get_artist() + u'". Please assign manually!'
            )

        if self._config.changed():
            self._config.save()

        print u"\n" + u'Assigning genres "' + u', '.join(tag_manager.get_tags()) + u'" to "' + mp3.get_title() + u'" by "' + mp3.get_artist() + u'".'

        mp3.set_genres(tag_manager.get_tags())
        mp3.set_processed()
        mp3.save()
开发者ID:norro,项目名称:pagger,代码行数:45,代码来源:main.py

示例3: do_shell

# 需要导入模块: from shell import Shell [as 别名]
# 或者: from shell.Shell import cmdloop [as 别名]
    def do_shell(self, _args):
        """
Issue Linux commands using provided shells within the context of Mercury
        """
        subconsole = Shell(self.session)
        subconsole.cmdloop()
开发者ID:tel0seh,项目名称:mercury,代码行数:8,代码来源:menu.py


注:本文中的shell.Shell.cmdloop方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。