I'm now use splunk-sdk-python-1.5.0 to create a search command.
How can I add a python module that is not included in the Splunk python bundle? Specifically, I would like to use the ctypes module from within Splunk to run a scripted input.
I added local python environment path just like below:
from sys import modules, path as python_path
python_path.insert(2, r'/usr/lib/python2.7/')
But got the below error:
Error in 'script': Getinfo probe failed for external search command 'sum'
from _ctypes import Union, Structure, Array
import ctypes
File "/opt/splunk/etc/apps/ericApp/bin/sum.py", line 23, in <module>
File "/usr/lib/python2.7/ctypes/__init__.py", line 10, in <module>
File "/usr/local/lib/python2.7/dist-packages/tensorflow/__init__.py", line 23, in <module>
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/__init__.py", line 29, in <module>
ImportError: No module named _ctypes
Traceback (most recent call last):
pydev debugger: warning: trying to add breakpoint to file that does not exist: /opt/splunk/etc/apps/ericApp/bin/C:/Users/shene/workspace/beginningPython/chapter01.py (will have no effect)
pydev debugger: warning: trying to add breakpoint to file that does not exist: /opt/splunk/etc/apps/ericApp/bin/C:/Users/shene/workspace/customerCommand/test.py (will have no effect)
The search job has failed due to an error. You may be able view the job in the Job Inspector.
... View more