<?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: ImportError: No module named Site in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/ImportError-No-module-named-Site/m-p/343024#M5349</link>
    <description>&lt;P&gt;If you want to run your script the way Splunk does (with its own libraries and modules) try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;C:\Program Files\Splunk\bin\splunk cmd python ../path to/your script.py
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I'm not suggesting this will solve your issue immediately, but under the covers that is how Splunk will execute your script.&lt;/P&gt;</description>
    <pubDate>Mon, 18 Dec 2017 09:39:55 GMT</pubDate>
    <dc:creator>nickhills</dc:creator>
    <dc:date>2017-12-18T09:39:55Z</dc:date>
    <item>
      <title>ImportError: No module named Site</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/ImportError-No-module-named-Site/m-p/343023#M5348</link>
      <description>&lt;P&gt;I am trying out Splunk on Windows Server 2012, version 6.6.3 and attempting to do a scripted lookup with a python script. My actual script (makes HTTP call, returns json, I parse and return csv) works with my own installation of Python 2.7 but when I try to run it with the built-in Splunk version I get ImportError: No module named Site&lt;/P&gt;

&lt;P&gt;I've searched and found a couple similar posts about this but what has me scratching my head is if I run "C:\Program Files\Splunk\bin\python.exe" test.py I get &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;ImportError: No module named Site 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now, the only thing in test.py is the statement&lt;/P&gt;

&lt;P&gt;print "hello"&lt;/P&gt;

&lt;P&gt;If I run "C:\Program Files\Splunk\bin\python.exe" -S test.py I get the expected output&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;hello
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This is a sanity test script of course, just to see if I can get it to do anything I'd expect. So what is going on with the -S (where I'm telling python to ignore site-packages I believe) vrs. not having that arg and I get an error? &lt;/P&gt;

&lt;P&gt;Is there something wrong with my install? With a simple print statement I'd expect the built-in Python to work without issue but it does not. &lt;/P&gt;

&lt;P&gt;Any ideas?? Thanks in advance for any input on this.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Dec 2017 08:28:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/ImportError-No-module-named-Site/m-p/343023#M5348</guid>
      <dc:creator>po1splunk</dc:creator>
      <dc:date>2017-12-18T08:28:31Z</dc:date>
    </item>
    <item>
      <title>Re: ImportError: No module named Site</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/ImportError-No-module-named-Site/m-p/343024#M5349</link>
      <description>&lt;P&gt;If you want to run your script the way Splunk does (with its own libraries and modules) try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;C:\Program Files\Splunk\bin\splunk cmd python ../path to/your script.py
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I'm not suggesting this will solve your issue immediately, but under the covers that is how Splunk will execute your script.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Dec 2017 09:39:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/ImportError-No-module-named-Site/m-p/343024#M5349</guid>
      <dc:creator>nickhills</dc:creator>
      <dc:date>2017-12-18T09:39:55Z</dc:date>
    </item>
    <item>
      <title>Re: ImportError: No module named Site</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/ImportError-No-module-named-Site/m-p/343025#M5350</link>
      <description>&lt;P&gt;Ah, subtle difference. This runs the script as intended. Thank you for this help!!&lt;/P&gt;</description>
      <pubDate>Mon, 18 Dec 2017 14:49:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/ImportError-No-module-named-Site/m-p/343025#M5350</guid>
      <dc:creator>po1splunk</dc:creator>
      <dc:date>2017-12-18T14:49:19Z</dc:date>
    </item>
  </channel>
</rss>

