<?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: How do I add a python module for external lookup command? in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/How-do-I-add-a-python-module-for-external-lookup-command/m-p/34771#M409</link>
    <description>&lt;P&gt;Thanks for your reply. I think the the field header arguments would have to be put in the myprocess = ... part. Lowell provided an even easier answer in a past post for my module that happens to be in an egg: Lowell wrote "Instead I recommend creating .egg files, putting them in your own lib folder, and explicitly doing a sys.path.append("/your/lib/whatever.egg") before your import."&lt;/P&gt;</description>
    <pubDate>Wed, 29 Jun 2011 00:32:23 GMT</pubDate>
    <dc:creator>ndoshi</dc:creator>
    <dc:date>2011-06-29T00:32:23Z</dc:date>
    <item>
      <title>How do I add a python module for external lookup command?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-do-I-add-a-python-module-for-external-lookup-command/m-p/34769#M407</link>
      <description>&lt;P&gt;I know the answers site has a description for having one Python program call another, which includes a custom module, but this seems to be more geared for scripted inputs or alerts. &lt;A href="http://splunk-base.splunk.com/answers/8/can-i-add-python-modules-to-the-splunk-environment"&gt;http://splunk-base.splunk.com/answers/8/can-i-add-python-modules-to-the-splunk-environment&lt;/A&gt;. I have a custom module that works outside of Splunk in Python 2.6, but I need to use this within a lookup Python script. The script will have parameters passed within it as labeled in transforms.conf. The custom module will eventually call native C/C++ code. The module builds itself into an egg file. I can't simply drop this file into Splunk's Python 2.6 site-packages directory as even the import didn't work. How do I let Splunk know about this module so that the lookup Python script can import and use it?&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jun 2011 03:25:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-do-I-add-a-python-module-for-external-lookup-command/m-p/34769#M407</guid>
      <dc:creator>ndoshi</dc:creator>
      <dc:date>2011-06-27T03:25:27Z</dc:date>
    </item>
    <item>
      <title>Re: How do I add a python module for external lookup command?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-do-I-add-a-python-module-for-external-lookup-command/m-p/34770#M408</link>
      <description>&lt;P&gt;Try using a wrapper script. The one described in the answer you link to is possibly more complex than what's needed for lookups. I solved this problem yesterday using a wrapper, as follows.&lt;/P&gt;

&lt;P&gt;wrapper.py:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;import os

NEW_PYTHON_PATH = '/usr/bin/python'

os.environ['PYTHONPATH'] = NEW_PYTHON_PATH
my_process = '/opt/splunk/etc/apps/zgp/bin/lookup.py')

os.execv(my_process, ())
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 28 Jun 2011 19:40:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-do-I-add-a-python-module-for-external-lookup-command/m-p/34770#M408</guid>
      <dc:creator>BryantD</dc:creator>
      <dc:date>2011-06-28T19:40:53Z</dc:date>
    </item>
    <item>
      <title>Re: How do I add a python module for external lookup command?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-do-I-add-a-python-module-for-external-lookup-command/m-p/34771#M409</link>
      <description>&lt;P&gt;Thanks for your reply. I think the the field header arguments would have to be put in the myprocess = ... part. Lowell provided an even easier answer in a past post for my module that happens to be in an egg: Lowell wrote "Instead I recommend creating .egg files, putting them in your own lib folder, and explicitly doing a sys.path.append("/your/lib/whatever.egg") before your import."&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jun 2011 00:32:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-do-I-add-a-python-module-for-external-lookup-command/m-p/34771#M409</guid>
      <dc:creator>ndoshi</dc:creator>
      <dc:date>2011-06-29T00:32:23Z</dc:date>
    </item>
    <item>
      <title>Re: How do I add a python module for external lookup command?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-do-I-add-a-python-module-for-external-lookup-command/m-p/34772#M410</link>
      <description>&lt;P&gt;As an aside, I was able to call a script with this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;#!/bin/bash
/usr/bin/python /path/to/python/script.py
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;.. andit found all my moduldes and worked fine.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2012 21:18:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-do-I-add-a-python-module-for-external-lookup-command/m-p/34772#M410</guid>
      <dc:creator>rosslord</dc:creator>
      <dc:date>2012-02-03T21:18:48Z</dc:date>
    </item>
    <item>
      <title>Re: How do I add a python module for external lookup command?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-do-I-add-a-python-module-for-external-lookup-command/m-p/34773#M411</link>
      <description>&lt;P&gt;My original question was for lookup scripts as lookups call Python directly and do not call shell scripts.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Feb 2012 14:12:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-do-I-add-a-python-module-for-external-lookup-command/m-p/34773#M411</guid>
      <dc:creator>ndoshi</dc:creator>
      <dc:date>2012-02-06T14:12:15Z</dc:date>
    </item>
  </channel>
</rss>

