You will need to escape the comma as "\," (but in the python script, since the pattern was quoted, escaping wasn't necessary).
It still errors, I'm not sure why, but it
is more complex than it needs to be, so...
Try this template, which I rewrote from scratch:
Code:
{author_sort:re(\, (\w)\w*,\, \1.)}
Explanation:
Search for:
comma, space, letter (captured), letters. [Stop at the first non-letter value.]
Replace with:
comma, space, captured first letter, period