Talk:What Fools These Mortals

From NetHackWiki
Jump to: navigation, search

whrandom

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

  1. Delete import whrandom
  2. Change rand = whrandomm.whrandom to rand = random

69.228.170.186 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 "./WhatFools.py", line 209
       as = alignmentSelection.keys()
        ^
   SyntaxError: invalid syntax

--Preceding unsigned comment added by 60.242.66.41 (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()
       ak.sort()
       rs = roleMap.keys()
       rs.sort()
       print 'Usage: %s [-a%s] [-p%s] [-D]' % (sys.argv[0],
                                               string.join(ak, ),
                                               string.join(rs, ))
       sys.exit(exit)
Shijun 21:39, January 22, 2010 (UTC)

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