All Apps and Add-ons

Python 2 to Python 3 Compatibility

dwraesner
Explorer

After running the Splunk Platform Upgrade Readiness App, 1 of many add-ons / apps on just 1 Splunk Enterprise server that did not pass was the Splunk Add-on for Cisco ISE newest version 3.0.0. Just this 1 app has 117 python scripts that need to be made compatible, "Required Action: Update these Python scripts to be dual-compatible with Python 2 and 3."

Does Splunk have a conversion script which can be run, for any app, to convert Python 2 scripts to be dual-compatible?

If no, then will the Add-on for Cisco ISE be Python 3 compatible? Also, when will all the other Splunk built add-ons and apps be Python 3 compatible so upgrading to Splunk 8 can proceed?

0 Karma

dwraesner
Explorer

Thanks, downloaded six, and below in quotes is the related documentation I found. Do you simply copy the six.py file as suggested into the bin directory of the app where the non-compatible .py scripts are located? I did that, and ran the Upgrade Readiness App on that app again, but the python scripts still do not pass as Python 3 compatible.

"Six provides simple utilities for wrapping over differences between Python 2 and Python 3. It is intended to support codebases that work on both Python 2 and 3 without modification. six consists of only one Python file, so it is painless to copy into a project."

0 Karma

dwraesner
Explorer

Thanks, currently we're running Splunk Enterprise 7.2.7 which has the $SPLUNK_HOME/Splunk/Python-2.7/Lib folder. What is the detailed procedure for making these 2.7 lib's also dual compatible with Python 3.x version.

0 Karma

atammana_splunk
Splunk Employee
Splunk Employee

@dwraesner , this is done per-app - you don't want to mess with Splunk's shipped interpreter. Plus, this really only applies to apps you own; apps that belong to Splunk or other developers should be handled by the owner.

If you have your own apps that use Python, you can import Python libraries such as Six and Future to make each script compatible with Python 2 and 3. Documentation for using these libraries can be found on the web, for example here: https://pypi.org/project/six/

0 Karma

atammana_splunk
Splunk Employee
Splunk Employee

Hi @dwraesner , the Upgrade Readiness App's most recent version was released on Feb 5, 2020; the newest version for the Add-on for Cisco ISE was released after this, on Feb 11, 2020. The readiness app pulls a static list from Splunkbase before each release. As a result, it likely doesn't know that the newest version of the add-on is actually compatible (and if you look on Splunkbase, you'll see it is). In short, you should be good to go for that app.

As a note, Splunk does not have a conversion script available, but you can use dual-compatible Python libraries to achieve this.

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...