<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Can Customer Command use import a local python module? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Can-Customer-Command-use-import-a-local-python-module/m-p/217318#M63840</link>
    <description>&lt;P&gt;Just place the class under /bin of your app&lt;/P&gt;</description>
    <pubDate>Thu, 11 May 2017 18:01:44 GMT</pubDate>
    <dc:creator>dominiquevocat</dc:creator>
    <dc:date>2017-05-11T18:01:44Z</dc:date>
    <item>
      <title>Can Customer Command use import a local python module?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-Customer-Command-use-import-a-local-python-module/m-p/217317#M63839</link>
      <description>&lt;P&gt;I'm now use splunk-sdk-python-1.5.0 to create a search command. &lt;BR /&gt;
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.&lt;BR /&gt;
I added local python environment path just like below:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; from sys import modules, path as python_path
 python_path.insert(2, r'/usr/lib/python2.7/') 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But got the below error:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;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 &amp;lt;module&amp;gt;
File "/usr/lib/python2.7/ctypes/__init__.py", line 10, in &amp;lt;module&amp;gt;
File "/usr/local/lib/python2.7/dist-packages/tensorflow/__init__.py", line 23, in &amp;lt;module&amp;gt;
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/__init__.py", line 29, in &amp;lt;module&amp;gt;
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.
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Apr 2016 02:19:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-Customer-Command-use-import-a-local-python-module/m-p/217317#M63839</guid>
      <dc:creator>shenjunwei</dc:creator>
      <dc:date>2016-04-20T02:19:45Z</dc:date>
    </item>
    <item>
      <title>Re: Can Customer Command use import a local python module?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-Customer-Command-use-import-a-local-python-module/m-p/217318#M63840</link>
      <description>&lt;P&gt;Just place the class under /bin of your app&lt;/P&gt;</description>
      <pubDate>Thu, 11 May 2017 18:01:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-Customer-Command-use-import-a-local-python-module/m-p/217318#M63840</guid>
      <dc:creator>dominiquevocat</dc:creator>
      <dc:date>2017-05-11T18:01:44Z</dc:date>
    </item>
  </channel>
</rss>

