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.

1 Answer 1

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()
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.