I'm having an error using Python (inherited code). A Sum() function call that works on one platform is not working on another -- I think it is due to some syntax that is incompatible across platforms. The error I am getting is:
bsrlx1(112)% /usr/bin/python run-print.py init data
File "run-print.py", line 105
val = sum(1 if x >= 0.5 else 0 for x in metricC[key]);
^
SyntaxError: invalid syntax
Although this syntax works elsewhere. Anyone know of a syntax change or what the issue might be??
The version of Python I am calling is: Python 2.4.3 (#1, Apr 14 2011, 20:41:59) [GCC 4.1.2 20080704 (Red Hat 4.1.2-50)] on linux2
The header file in my program is:
#!/usr/bin/python2.5
So I think I may be using version 2.5
#!/usr/bin/python2.5is meaningless if you run it explicitly with the python command as in/usr/bin/python run-print.py init datasum(x >= 0.5 for x in metricC[key])becauseboolis anintsubclass, soTrueandFalsecan be added as if they were1and0.