I am getting this SyntaxError while using the IPinfo Splunk App on my Splunk Enterprise instance.
Environment Details:
Splunk Version: 9.2.2
App Name: IPinfo Splunk App
OS: Linux
Problem Description: When running the ipinfo command in a search, the command fails. Upon inspecting the search.log, I found that the external search command is exiting with a SyntaxError.
It appears the script ipinfo_command.py uses the assignment expression (Walrus Operator :=), which was introduced in Python 3.8. However, even on Splunk 9.2.2, the script is being invoked using the bundled Python 3.7 interpreter in my environment, leading to the following error:
ERROR ChunkedExternProcessor - stderr: File "/opt/splunk/etc/apps/ipinfo_app/bin/ipinfo_command.py", line 139
ERROR ChunkedExternProcessor - stderr: ip_addresses = [v.strip() for f in fields if (v := record.get(f)) and v.strip()]
ERROR ChunkedExternProcessor - stderr: ^
ERROR ChunkedExternProcessor - stderr: SyntaxError: invalid syntax
ERROR ChunkedExternProcessor - Error in 'ipinfo' command: External search command exited unexpectedly with non-zero error code 1.
Can someone please help ?
Hi,
I work for IPinfo. Can you please open a support ticket with us? Our integration engineering team will take a look.
— Abdullah | DevRel, IPinfo
I already opened a case 12 days ago but have not heard back on the issue yet.
Which version of the app are you running, and does your Splunk deployment only have Python 3.7?
Can you check which Python runtimes are available on your Splunk instance, and if you have a 3.7+ runtime, explicitly reference that in the app’s commands.conf and test the command again.
$SPLUNK_HOME/bin/splunk cmd python3 -V
Regards,
Prewin
🌟If this answer helped you, please consider marking it as the solution or giving a Karma. Thanks!
9.4.0 is the App version
/opt/splunk/bin/splunk cmd python3 -V
Output is Python 3.7.17