Autokey error, not apparently related to my script
Solution 1:
Perhaps I should have posted the question on Stack Overflow, I might have got an answer from a Python programmer.
I found the file scripting.py on git, and that line had been changed. I don't understand how I had installed an old version, the application version is current. git blame indicated this is the only change in that file.
Changing line 497 fixed my error. From
if output[-1]==”\n”:
to
if output.endswith("\n"):