tutorials icon indicating copy to clipboard operation
tutorials copied to clipboard

raise tokenizer.ParseErrorPreviousToken

Open MojtabaTaj opened this issue 1 year ago • 3 comments

hello . I have installed the requirements for running exercises . i started with basic.p4 . when i do the make i get this error .

File "/usr/local/lib/python3.10/dist-packages/google/protobuf/text_format.py", line 932, in _MergeField raise tokenizer.ParseErrorPreviousToken( google.protobuf.text_format.ParseError: 25:3 : Message type "p4.config.v1.Table" has no field named "initial_default_action". make: *** [../../utils/Makefile:35: run] Error 1

MojtabaTaj avatar Sep 02 '24 07:09 MojtabaTaj

Yes, I have seen this recently, too. It is because on 2024-Aug-26 p4c was updated so that it adds a new field describing P4 tables to the P4Info files it generates, but other projects consuming P4Info files have not yet been updated to the new P4Runtime API message definitions.

That updating will happen, but unless someone gets a bee under their bonnet to do it very soon, it could be a month or two.

In the next day or two, I plan to commit a change to whichever p4lang repo that is causing this issue, by adding a new optional parameter allow_unknown_field=True to a call to method google.protobuf.text_format.Merge that is almost certainly somewhere in the full call stack of the exception that you see.

If you would like to make a quick fix that gets you moving forward before then, look for that call in your call stack, look at the full path name of the file where there is a call to google.protobuf.text_format.Merge, and line number, then edit that file to add that optional parameter, similar to the change you see here: https://github.com/p4lang/p4runtime-shell/pull/132/files

jafingerhut avatar Sep 02 '24 16:09 jafingerhut

Hello,

Thank you for your message. I have been trying to locate the file mentioned as google.protobuf.text_format.Merge, but I couldn't find it. After installing p4dev-v6.sh on my Ubuntu 22.04, I noticed that the p4runtime.py script was missing.

Is it necessary to have p4runtime.py, or do I need to modify helper.py to achieve the correct result? If so, could you please tell me exactly where the command should be added?

Thank you for your consideration.

MojtabaTaj avatar Sep 02 '24 22:09 MojtabaTaj

Try git pull in your copy of this tutorials repository, and it should update at the one Merge Python call that was causing problems for me. If that fixes it for you, great.

If not, then I would recommend copying and pasting the entire stack trace (not just one or two lines of it) into a comment so that someone might be able to help diagnose it.

jafingerhut avatar Sep 03 '24 01:09 jafingerhut

No follow up in a while on this problem, so presuming it has been fixed. Feel free to reopen, or open a new issue, for future problems.

jafingerhut avatar Nov 06 '24 16:11 jafingerhut