# pylint: disable=multiple-imports
import os, sys, math, curses, time, pickle, copy, gettext, getpass
-import getopt, socket, locale, getpass
+import getopt, socket, locale
import codecs
# This import only works on Unixes. The intention is to enable
s = Coord()
self.nexttok()
if (game.options & OPTION_ALPHAMERIC):
- if (self.type == "IHALPHA") and (self.token[0] in "abcdefghij") and (self.token[1] in "0123456789"):
- s.i = ord(self.token[0]) - ord("a")
- try:
- s.j = int(self.token[-1:])-1
- except TypeError:
- huh()
- return None
- return s
+ try:
+ if (self.type == "IHALPHA") and (self.token[0] in "abcdefghij") and (self.token[1] in "0123456789"):
+ s.i = ord(self.token[0]) - ord("a")
+ s.j = int(self.token[1:])-1
+ return s
+ except (TypeError, IndexError):
+ huh()
+ return None
if self.type != "IHREAL":
huh()
return None