Python: SyntaxError: keyword can't be an expression

Ricky Robinson picture Ricky Robinson · Jul 24, 2012 · Viewed 167.6k times · Source

In a Python script I call a function from rpy2, but I get this error:

#using an R module 
res = DirichletReg.ddirichlet(np.asarray(my_values),alphas,
                              log=False, sum.up=False) 
SyntaxError: keyword can't be an expression

What exactly went wrong here?

Answer

Sven Marnach picture Sven Marnach · Jul 24, 2012

sum.up is not a valid keyword argument name. Keyword arguments must be valid identifiers. You should look in the documentation of the library you are using how this argument really is called – maybe sum_up?