Hi, I think your problem is related to spacing. I have the same version of python, Ubuntu and FEniCS as you do and your code does not compile on my machine either. However
S = Expression('(x[0]<1) ? 0.1/(0.5*t*t+1) : 0.0',t=0.0)
is okay and so is
S = Expression('(x[0]<1)?0.1/(0.5*t*t+1) : 0.0',t=0.0)
(note spaces around colon) or
S = Expression('(x[0]<1)?0.1/(0.5*t*t+1): 0.0',t=0.0)
(note only the trailing space after colon). Finally
S = Expression('(x[0]<1)?0.1/(0.5*t*t+1) :0.0',t=0.0)
(note only the leading space) fails to compile.