A Python function is called with (rounded) parantheses, the SPSS command to execute is a delimited string for Python, and SPSS commands are generally terminated by a full stop. Try
spss.Submit('compute flag=1 .')
If you need the effect immediatly, you may append
spss.Submit('execute .')
------------------------------
Kai Borgolte
------------------------------