better handle bad block names
This commit is contained in:
parent
3993f041ea
commit
69c29a08a8
13
mce.py
13
mce.py
@ -122,14 +122,21 @@ class mce(object):
|
|||||||
else:
|
else:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if blockType is None:
|
|
||||||
print "Ambiguous block specifier. Matches: ", matches;
|
|
||||||
raise ValueError
|
|
||||||
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
try:
|
||||||
blockType = int(keyword);
|
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
|
return blockType
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user