本文整理汇总了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))
示例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()
示例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()