I see below error while running installation script of Splunk Forwarder Add-on for WAS.
$ python wasloginputs.py
File "wasloginputs.py", line 228
with open('../local/'+componentconf, 'wb') as configfile:
SyntaxError: invalid syntax
Universal forwarder binary name: splunkforwarder-4.3.2-123586-Linux-x8664
WAS Add on binary name: splunkforwarderaddonwas-2.0.0-123159.tar
It appears that the Python "with" statement didn't exist until sometime after Python 2.5. Not an authoritative source, but good enough for a perl/shell programmer:
The with statement in Python simplifies exception handling by encapsulating common preparation and clean-up tasks in so-called context managers. This allows common try..except..finally usage patterns to be encapsulated for convenient reuse and reduce the amount of code you need to write for handling different kinds of exceptions. The with statement creates resources within a block . You write your code using the resources within the block. When the block exits the resources are cleanly released regardless of the outcome of the code in the block (that is whether the block exits normally or because of an exception).