Developing for Splunk Enterprise

splunk sdk for python : splunk.Intersplunk module not found


Hi Splunk,

I'm getting an error after installing splunk sdk for python. The error is:

Traceback (most recent call last):
File "./", line 4, in
import splunk.Intersplunk
ImportError: No module named splunk.Intersplunk

I can see the splunk.Intersplunk module in dir:

The program is basic:

!/usr/bin/env python

import sys
import subprocess
import splunk.Intersplunk
cmdargs = str(sys.argv)
programname = "/lmtmp/"[program_name, cmdargs])

PYTHONPATH variable in .bash_profile is:

NOTE, if i replace import splunk.Intersplunk with import splunklib the program runs without any issue.

Is there something wrong with python path? Anyone, been at it for awhile and currently stumped.


Labels (2)
0 Karma

Re: splunk sdk for python : splunk.Intersplunk module not found


You need to use export PYTHONPATH so that this variable get passed to the child process called (to run program_name) in your script. Export PYTHONPATH instead just setting it in .bash_profile.

export PYTHONPATH=/apps/splunk/etc/apps/splunk-sdk-python
0 Karma
Speak Up for Splunk Careers!

We want to better understand the impact Splunk experience and expertise has has on individuals' careers, and help highlight the growing demand for Splunk skills.