pycfr icon indicating copy to clipboard operation
pycfr copied to clipboard

AttributeError: when importing pokergames.leduc_gametree

Open xoren22 opened this issue 5 years ago • 1 comments

machine: intel core i3, Ubuntu 16.04, python 3.6 how to reproduce -

  1. git clone repo
  2. cd to local folder containing the repo
  3. create a jupyter notebook and import leduc as follows from pokergames import leduc_gametree

The error message attached below:

`--------------------------------------------------------------------------- AttributeError Traceback (most recent call last) in ----> 1 from pokergames import leduc_gametree

~/Desktop/pycfr/pokergames.py in ----> 1 from pokertrees import * 2 3 def kuhn_eval(hc, board): 4 return hc[0].rank 5

~/Desktop/pycfr/pokertrees.py in 3 from itertools import product 4 from collections import Counter ----> 5 from hand_evaluator import HandEvaluator 6 from copy import deepcopy 7 from functools import partial

~/Desktop/pycfr/hand_evaluator.py in ----> 1 from lookup_tables import LookupTables 2 from popcount import PopCount 3 from itertools import combinations 4 from operator import mul, or, and, xor 5

~/Desktop/pycfr/lookup_tables.py in ----> 1 from card import Card 2 3 class LookupTables: 4 """ 5 Top level attributes are general, like primes, deck, etc

~/Desktop/pycfr/card.py in 1 import re 2 ----> 3 class Card: 4 SUIT_TO_STRING = { 5 1: "s",

~/Desktop/pycfr/card.py in Card() 30 RANK_ACE = 14 31 ---> 32 STRING_TO_SUIT = dict([(v, k) for k, v in SUIT_TO_STRING.iteritems()]) 33 STRING_TO_RANK = dict([(v, k) for k, v in RANK_TO_STRING.iteritems()]) 34

AttributeError: 'dict' object has no attribute 'iteritems'`

xoren22 avatar Jul 06 '20 10:07 xoren22

This is a python 3 compatibility issue. Right now the code only supports python 2.7. I'm happy to accept a pull request if anyone wants to upgrade the code. I'm not sure when I'll have time to do it myself.

tansey avatar Jul 06 '20 13:07 tansey