Getting Data In

Python script error during installation of Splunk Forwarder Add-on for WAS

lalbsah
Engager

I see below error while running installation script of Splunk Forwarder Add-on for WAS.
$ python was_log_inputs.py
File "was_log_inputs.py", line 228
with open('../local/'+componentconf, 'wb') as configfile:
^
SyntaxError: invalid syntax

Universal forwarder binary name: splunkforwarder-4.3.2-123586-Linux-x86_64
WAS Add on binary name: splunk_forwarder_addon_was-2.0.0-123159.tar

Please advise.

0 Karma

quincybatten
New Member

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).

0 Karma

glitchcowboy
Path Finder

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:

http://preshing.com/20110920/the-python-with-statement-by-example

0 Karma

glitchcowboy
Path Finder

I have the same issue - albeit on AIX.

python -V
Python 2.3.4

Has anyone solved this yet?

0 Karma
Get Updates on the Splunk Community!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...