Many thanks for the explicit instructions Russ. That worked fine !
My previous attempt was using and new project file. FC prompts to create a new job via create job dlg. At this point the treeview shows a new entry “Custom”. The dlg “model” panel is empty ( logical for a new project ) and I clicked OK. At that point I get the traceback shown above.
It seems that there is an (erroneous) assumption that some existing underlying elements are present and this is not checked for and trapped. I’ve been pointing out the need to better error trapping in FreeCAD for several years but there does not even seem to any agreement that this is desirable. There seems to be some kind aversion to this generally in Python programming.
It really would be desirable if FC could check for whatever it assumes is there before relying on it and dumping a traceback which is of zero use to the user. Alternatively the error should caught at level where it occurs and a meaningful msg shown.
I did a search for “Import GCODE into FreeCAD” and most of what I saw was threads like this one showing problems. In fact I was already doing the right thing, except that it does not appear to work from and empty project.
My need here was to visualise some GCODE I created with an awk script and to check it in the simulator. That is why I used a new project instead of cluttering an existing one.
Maybe someone needs to look at why this fails with an empty project. It seems to intend to create a new job but I only see the new operation in the tree.
Some further digging:
Creating a new job with an empty Body fails silently. This is presumably what is happening with the automatic job creation, leading to further errors when it assumes erroneously that it succeeded ( and never checked ).
With a trivial object like a cylinder in the Body, the job creation process has something to work with, however this then opens the Job Edit dlg on the Setup tab. In the meantime the import process carries on without the user closing the dlg and similar traceback occurs. On closing the job edit dlg, the tree has the new job and empty Operations object. An empty Custom object exists under Body.
The pythonist paradigm of letting errors bubble up still requires they get treated somewhere, it should not lead to a traceback.
This is probably quite trivial to pin down and fix with the information supplied here. Results here were from recent master build.
Anyway, many thanks for the tips on how do this. Just knowing it works was great. That’s enabled me to achieve what I wanted to do. 
OS: Fedora 34 (Thirty Four) (LXQt//usr/share/xsessions/lxqt)
Word size of FreeCAD: 64-bit
Version: 0.20.27976 (Git)
Build type: Release
Branch: master
Hash: 84f23401709f2efb95bfb59680b8746b945136be
Python 3.9.10, Qt 5.15.2, Coin 4.0.0a, OCC 7.5.0
Locale: English/United Kingdom (en_GB)
Installed mods:
* FreeCAD_Assembly4 0.11.10
* FreeCAD_assembly3