Splunk Dev

What is the difference between '/opt/splunk/bin/python' and '/opt/splunk/bin/splunk cmd python'

shrirangphadke
Path Finder

Hi,

I am having a strange python behavior in my Splunk environment :

When I run a script with Splunk python as:

/opt/splunk/bin/python my_script.py

it fails. But when I run same script as:

/opt/splunk/bin/splunk cmd python my_script.py

it works. This is really a strange behavior to me.
My questions are:
1. Why first option does not work?
2. What can I do to load 'Splunk cmd python' in my django environment.

0 Karma
1 Solution

MuS
Legend

Hi shrirangphadke,

  1. it does not have the Splunk environment variables set
  2. if you can source /opt/splunk/bin/setSplunkEnv in your django enviroment it will run the script as well

/opt/splunk/bin/splunk is actually a wrapper which load the setSplunkEnv and starts the later command.

Hope this helps ...

cheers, MuS

View solution in original post

MuS
Legend

Hi shrirangphadke,

  1. it does not have the Splunk environment variables set
  2. if you can source /opt/splunk/bin/setSplunkEnv in your django enviroment it will run the script as well

/opt/splunk/bin/splunk is actually a wrapper which load the setSplunkEnv and starts the later command.

Hope this helps ...

cheers, MuS

shrirangphadke
Path Finder

Thanks for your answer @Mus !!

Your answer is a key to some of my major issues.
Thanks again

0 Karma

MuS
Legend

you're welcome 🙂

0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...