Talk:What Fools These Mortals

From NetHackWiki
Jump to: navigation, search


If you don't have whrandom, you can edit the file by:

  1. Delete import whrandom
  2. Change rand = whrandomm.whrandom to rand = random 02:13, 1 March 2008 (UTC)

Running WFTM in recent versions of Python

I am having problems, when I run this, I get an error:

File "./", line 209
       as = alignmentSelection.keys()
   SyntaxError: invalid syntax

--Preceding unsigned comment added by (talkcontribs) 2010-01-21, 23:00

Are you running Python 2.6 (or higher)? "as" became a keyword in 2.6, so it can't be used as a name for a variable (giving you that syntax error). One solution is to use an older version of Python. The other is to rename that variable to "ak". You'll have to do this in three different places in that method. It should look something like this:
def usage(self, exit=1):
       ak = alignmentSelection.keys()
       rs = roleMap.keys()
       print 'Usage: %s [-a%s] [-p%s] [-D]' % (sys.argv[0],
                                               string.join(ak, ),
                                               string.join(rs, ))
Shijun 21:39, January 22, 2010 (UTC)

thanks. 23:07, January 22, 2010 (UTC)