Getting Data In

Script input Error - No module named splunklib.client

tamduong16
Contributor

I am trying to index data from my python script. Everything set up correctly but I still don't see data coming in. So search for events using index=_internal sourcetype=splunkd and have the following error:
ERROR ExecProcessor - message from "python "C:\Program Files\Splunk\etc\system\bin\REV_API_viewerreport.py"" ImportError: No module named splunklib.client.

I tried copying the package to the same folder where I have my script but it still giving me the same error. What should I do?
Thanks

0 Karma
1 Solution

damien_chillet
Builder

splunklib.client is part of the Splunk Python SDK.
Did you follow the guide for installation of the SDK (http://dev.splunk.com/view/python-sdk/SP-CAAAEDG)?

It seems like your PYTHONPATH environment variable is not set properly, causing import statement to fail.

View solution in original post

damien_chillet
Builder

splunklib.client is part of the Splunk Python SDK.
Did you follow the guide for installation of the SDK (http://dev.splunk.com/view/python-sdk/SP-CAAAEDG)?

It seems like your PYTHONPATH environment variable is not set properly, causing import statement to fail.

tamduong16
Contributor

@damien_chillet
Thanks for the answer. I placed the file splunk-sdk-python-1.6.3 in my C drive. Then I went to edit my eviromental variable for Path and wrote this line: PYTHONPATH=C:\splunk-sdk-python-1.6.3. But I still have the same error. Am I doing it right?

0 Karma

damien_chillet
Builder

Hey,
can you run python -c 'import sys; print sys.path' and check if the SDK path appears in there?
I believe you need to restart your Windows machine for the new environment variable to appear.

0 Karma

p_gurav
Champion

How you are running script? Did you set pythonpath to the splunk path?

0 Karma

tamduong16
Contributor

How can I set pythonpath to the splunk path? I'm confuse.

0 Karma
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...