<?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: Unable to run python script in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Unable-to-run-python-script/m-p/454014#M8269</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Are you running script manually with same user as splunk process is running ?&lt;/P&gt;</description>
    <pubDate>Thu, 21 Mar 2019 15:33:41 GMT</pubDate>
    <dc:creator>harsmarvania57</dc:creator>
    <dc:date>2019-03-21T15:33:41Z</dc:date>
    <item>
      <title>Unable to run python script</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Unable-to-run-python-script/m-p/454013#M8268</link>
      <description>&lt;P&gt;Unable to run python script with inputs.conf, getting below errors&lt;/P&gt;

&lt;P&gt;03-21-2019 10:11:03.474 -0400 ERROR ExecProcessor - message from "python $Splunk_home/etc/apps/XX/bin/X.py"   File "$Splunk_home/etc/apps/XX/bin/X.py", line 100, in &lt;BR /&gt;
03-21-2019 10:11:03.474 -0400 ERROR ExecProcessor - message from "python $Splunk_home/etc/apps/XX/bin/X.py"     fileIo = open(logFile,'w')&lt;BR /&gt;
03-21-2019 10:11:03.474 -0400 ERROR ExecProcessor - message from "python $Splunk_home/etc/apps/XX/bin/X.py" IOError: [Errno 13] Permission denied: u'.//21_03_2019-10_11_02-datafeed.json'&lt;/P&gt;

&lt;P&gt;But I can run script manually. $Splunk_home/bin/splunk cmd python $Splunk_home/etc/apps/XX/bin/X.py&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 23:47:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Unable-to-run-python-script/m-p/454013#M8268</guid>
      <dc:creator>jayakumar19</dc:creator>
      <dc:date>2020-09-29T23:47:39Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to run python script</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Unable-to-run-python-script/m-p/454014#M8269</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Are you running script manually with same user as splunk process is running ?&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2019 15:33:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Unable-to-run-python-script/m-p/454014#M8269</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2019-03-21T15:33:41Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to run python script</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Unable-to-run-python-script/m-p/454015#M8270</link>
      <description>&lt;P&gt;Thanks Harsmarvania for looking into it. Yes I am running it as splunk user.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2019 16:15:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Unable-to-run-python-script/m-p/454015#M8270</guid>
      <dc:creator>jayakumar19</dc:creator>
      <dc:date>2019-03-21T16:15:34Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to run python script</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Unable-to-run-python-script/m-p/454016#M8271</link>
      <description>&lt;P&gt;Based on logs which you have provided it is saying that splunk process which is running as splunk user doesn't have permission to read &lt;CODE&gt;21_03_2019-10_11_02-datafeed.json&lt;/CODE&gt; file.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2019 18:35:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Unable-to-run-python-script/m-p/454016#M8271</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2019-03-21T18:35:23Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to run python script</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Unable-to-run-python-script/m-p/454017#M8272</link>
      <description>&lt;P&gt;Actually script is trying to create that file. Manual run is able to create new file.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2019 18:42:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Unable-to-run-python-script/m-p/454017#M8272</guid>
      <dc:creator>jayakumar19</dc:creator>
      <dc:date>2019-03-21T18:42:09Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to run python script</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Unable-to-run-python-script/m-p/454018#M8273</link>
      <description>&lt;P&gt;That's strange, in which directory splunk tries to create file using that script ?&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2019 18:47:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Unable-to-run-python-script/m-p/454018#M8273</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2019-03-21T18:47:49Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to run python script</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Unable-to-run-python-script/m-p/454019#M8274</link>
      <description>&lt;P&gt;Hi jayakumar19,&lt;/P&gt;

&lt;P&gt;Usually I do this to test/troubleshoot scripts in Splunk:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; $SPLUNK_HOME/bin/splunk cmd /bin/bash
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will start a shell session with all Splunk environment settings. Then I start the script like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;$SPLUNK_HOME/bin/splunk cmd $SPLUNK_HOME/etc/apps/XX/bin/X.py
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This helps a lot to understand where and/or why scripts fail to run.&lt;/P&gt;

&lt;P&gt;In addition I add logging lines into the script that will tell me variables being used and which step is being processed. You can add them like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;logging.debug('what ever you want to show in the logfile')
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hope that helps ...&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2019 18:56:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Unable-to-run-python-script/m-p/454019#M8274</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2019-03-21T18:56:50Z</dc:date>
    </item>
  </channel>
</rss>

