It may be that the problem is caused by USB. So I will take in a parallel cable and set it up as /dev/lp0, and see if that works.
The other thing to do might be rather than passing a command to the shell, to launch a shell script from the programme. That would maybe allow the programme to continue to step through without being locked by failure of the print command, and I could maybe find some way to drop out of the shell if the printer is offline?
Next time, moral is, buy a printer with linux drivers. It will be cheap at the price, whatever it is.
Peter