From 69c29a08a8b6b6d8a3339ad49eb344cb21e69cf8 Mon Sep 17 00:00:00 2001 From: David Vierra Date: Sun, 19 Sep 2010 13:43:40 -1000 Subject: [PATCH] better handle bad block names --- mce.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/mce.py b/mce.py index ec09d99..918928b 100644 --- a/mce.py +++ b/mce.py @@ -122,15 +122,22 @@ class mce(object): else: break; - if blockType is None: - print "Ambiguous block specifier. Matches: ", matches; - raise ValueError - + else: - blockType = int(keyword); + try: + blockType = int(keyword); + except ValueError: + blockType = None; + + if blockType is None: + print "Ambiguous block specifier: ", keyword + if len(matches): + print "Matches: ", matches; + else: + print "No blocks matched." + raise ValueError - return blockType def _debug(self, command):