2

Here is the code I use:

from P4 import P4, P4Exception    
mp = P4.Map()

And here's the error I get:

mp = P4.Map() AttributeError: type object 'P4' has no attribute 'Map'

WHY? According to P4Python manuals such class method should construct a new Map object.

Rakesh
  • 81,458
  • 17
  • 76
  • 113
w.wa
  • 35
  • 6

1 Answers1

3

Because you import class P4 from P4.py. Map is another class from P4.py. See source code: https://github.com/rptb1/p4python/blob/master/P4.py

You should try this:

import P4
mp = P4.Map()
Artem Getmanskiy
  • 193
  • 2
  • 16