P4Python : AttributeError: type object 'P4' has no attribute 'Map'
P4Python : AttributeError: type object 'P4' has no attribute 'Map'
这是我使用的代码:
from P4 import P4, P4Exception
mp = P4.Map()
这是我得到的错误:
mp = P4.Map() AttributeError: type object 'P4' has no attribute 'Map'
为什么?
根据 P4Python 手册,这种 class 方法应该构造一个新的 Map 对象。
因为您从 P4.py
导入 class P4
。地图是来自 P4.py 的另一个 class。查看源代码:https://github.com/rptb1/p4python/blob/master/P4.py
你应该试试这个:
import P4
mp = P4.Map()
这是我使用的代码:
from P4 import P4, P4Exception
mp = P4.Map()
这是我得到的错误:
mp = P4.Map() AttributeError: type object 'P4' has no attribute 'Map'
为什么? 根据 P4Python 手册,这种 class 方法应该构造一个新的 Map 对象。
因为您从 P4.py
导入 class P4
。地图是来自 P4.py 的另一个 class。查看源代码:https://github.com/rptb1/p4python/blob/master/P4.py
你应该试试这个:
import P4
mp = P4.Map()