As Abhijit already said you can't use the conditional expression in python<2.5, but you can work around this in two simple ways:
(r != rn and "~") or ""
Or:
"~" * (r != rn)
The first one is safe because "~"
is considered True
and thus if r != rn
then it is guaranteed that the and
will succeed and thus the or
will not evaluate the second expression.
The second one uses the fact that a string multiplied by 1
(or True
) returns the string itself, while the string multiplied by 0
(or False
) returns ""
(the empty string).
Edit:
Since the error is generated by a file that is not in your control, you shouldn't modify its source code. The fact that the library uses Python's2.5 syntax simply means that it does not support Python 2.4.3 and you either have to change library or to upgrade your python installation.
Since python2.4.x was last released in the 2008, I think it'd a good idea to upgrade your python installation to python2.7.3. This should solve your problem and you'll get all the benefits of the newer version of python.