Custom Code - Get firstname & lastname from email address

Above script is for Node.js and your error have .py extenson which indicates that you are using Python.
Change Language to node.js (drop down at very top of Custom code window)