<?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: Why am I receiving ModuleNotFoundError with custom module? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-receiving-ModuleNotFoundError-with-custom-module/m-p/643689#M222986</link>
    <description>&lt;P&gt;I have this same .py file both in my home directory and inside&amp;nbsp;&lt;STRONG&gt;/opt/splunk/etc/apps/search/bin&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;Should I create a &lt;STRONG&gt;lib&lt;/STRONG&gt; folder inside the search app to store the .py file? Shouldn't the binaries be stored inside a &lt;STRONG&gt;bin&lt;/STRONG&gt; folder?&lt;/P&gt;</description>
    <pubDate>Wed, 17 May 2023 20:30:58 GMT</pubDate>
    <dc:creator>newrose</dc:creator>
    <dc:date>2023-05-17T20:30:58Z</dc:date>
    <item>
      <title>Why am I receiving ModuleNotFoundError with custom module?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-receiving-ModuleNotFoundError-with-custom-module/m-p/643686#M222983</link>
      <description>&lt;P&gt;I'm trying to use a Python script with a custom module for a external lookup on Splunk. When running&lt;BR /&gt;&lt;STRONG&gt;&lt;BR /&gt;/opt/splunk/bin/splunk cmd python /opt/splunk/etc/apps/search/bin/gib_detect.py&lt;BR /&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;SPAN&gt;to test the script I get the following error:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Traceback (most recent call last):
File "/opt/splunk/etc/apps/search/bin/gib_detect.py", line 18, in &amp;lt;module&amp;gt;
import gib_detect_train
ModuleNotFoundError: No module named 'gib_detect_train'&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;But when running the same script outside Splunk folders with&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;/opt/splunk/bin/splunk cmd python /home/myuser/gib_detect.py&lt;BR /&gt;&lt;BR /&gt;&lt;/STRONG&gt;It works as intended.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;What I am doing wrong?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 17 May 2023 19:57:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-receiving-ModuleNotFoundError-with-custom-module/m-p/643686#M222983</guid>
      <dc:creator>newrose</dc:creator>
      <dc:date>2023-05-17T19:57:40Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I receiving ModuleNotFoundError with custom module?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-receiving-ModuleNotFoundError-with-custom-module/m-p/643687#M222984</link>
      <description>&lt;P&gt;Did you include gib_detect.py in /opt/splunk/etc/apps/search/lib?&amp;nbsp; It's probably in your home folder, but not in the Splunk folder.&lt;/P&gt;&lt;P&gt;BTW, it's best to create external commands in custom apps rather than in the search app.&lt;/P&gt;</description>
      <pubDate>Wed, 17 May 2023 20:06:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-receiving-ModuleNotFoundError-with-custom-module/m-p/643687#M222984</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2023-05-17T20:06:36Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I receiving ModuleNotFoundError with custom module?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-receiving-ModuleNotFoundError-with-custom-module/m-p/643689#M222986</link>
      <description>&lt;P&gt;I have this same .py file both in my home directory and inside&amp;nbsp;&lt;STRONG&gt;/opt/splunk/etc/apps/search/bin&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;Should I create a &lt;STRONG&gt;lib&lt;/STRONG&gt; folder inside the search app to store the .py file? Shouldn't the binaries be stored inside a &lt;STRONG&gt;bin&lt;/STRONG&gt; folder?&lt;/P&gt;</description>
      <pubDate>Wed, 17 May 2023 20:30:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-receiving-ModuleNotFoundError-with-custom-module/m-p/643689#M222986</guid>
      <dc:creator>newrose</dc:creator>
      <dc:date>2023-05-17T20:30:58Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I receiving ModuleNotFoundError with custom module?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-receiving-ModuleNotFoundError-with-custom-module/m-p/643690#M222987</link>
      <description>&lt;P&gt;Library files can be in &amp;lt;app&amp;gt;/bin/lib or &amp;lt;app&amp;gt;/lib.&lt;/P&gt;&lt;P&gt;I would resist the temptation to change the file structure of a standard app.&amp;nbsp; Put your external command into a new app.&lt;/P&gt;</description>
      <pubDate>Wed, 17 May 2023 20:39:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-receiving-ModuleNotFoundError-with-custom-module/m-p/643690#M222987</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2023-05-17T20:39:31Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I receiving ModuleNotFoundError with custom module?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-receiving-ModuleNotFoundError-with-custom-module/m-p/643693#M222988</link>
      <description>&lt;P&gt;That was my bad. The import is actually calling another file, the&amp;nbsp;&lt;STRONG&gt;gib_detect_train.py&lt;/STRONG&gt;, and was required inside the &lt;STRONG&gt;bin&lt;/STRONG&gt; folder as well.&lt;/P&gt;&lt;P&gt;And I will be following the&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213957"&gt;@richgalloway&lt;/a&gt;&amp;nbsp;advice of storing the files in a custom app.&lt;/P&gt;</description>
      <pubDate>Wed, 17 May 2023 20:53:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-receiving-ModuleNotFoundError-with-custom-module/m-p/643693#M222988</guid>
      <dc:creator>newrose</dc:creator>
      <dc:date>2023-05-17T20:53:00Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I receiving ModuleNotFoundError with custom module?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-receiving-ModuleNotFoundError-with-custom-module/m-p/643695#M222990</link>
      <description>&lt;P&gt;I appreciate your help.&lt;/P&gt;&lt;P&gt;I didn't provide all the detais about the script, and actually was missing another file inside the &lt;STRONG&gt;bin &lt;/STRONG&gt;folder.&lt;/P&gt;&lt;P&gt;I'll be using a custom app to keep the search app folder clean.&lt;/P&gt;</description>
      <pubDate>Wed, 17 May 2023 20:57:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-receiving-ModuleNotFoundError-with-custom-module/m-p/643695#M222990</guid>
      <dc:creator>newrose</dc:creator>
      <dc:date>2023-05-17T20:57:57Z</dc:date>
    </item>
  </channel>
</rss>

