0

我有一个小的python函数:

def rebuildTilePDB(cost, cols, rows, kept):
    import scripts.domains.tiles as tt
    print dir(tt)
    d = tt.tileDictioanry(cost=cost, rows=rows, cols=cols)
    path = tiles.findTilePDB(d, kept)
    print path

运行它会产生这个:

['__builtins__', '__doc__', '__file__', '__name__', '__package__', 'collections', 'filepaths', 'findTilePDB', 'os', 'tileDictionary', 'tilePDBDictionary']
Traceback (most recent call last):
  File "./domains/pdb_builder.py", line 107, in <module>
    rebuildTilePDB("unit", rows=3, cols=4, kept=[1,2,3,4,5])
  File "./domains/pdb_builder.py", line 83, in rebuildTilePDB
    d = tt.tileDictioanry(cost=cost, rows=rows, cols=cols)
AttributeError: 'module' object has no attribute 'tileDictioanry'

当 dir(tt) 显示 tt 模块有一个名为 tileDictionary 的函数时,我不明白为什么会出现错误。

4

1 回答 1

3

这是一个错字:tt.tileDictioanry必须是tt.tileDictionary

于 2013-06-14T18:30:14.460 回答