<?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: Python SDK file upload issue in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Python-SDK-file-upload-issue/m-p/445893#M8076</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;is there no file extention like test.sh or test.py? Looks like your path is pointing to a folder, not a file.&lt;BR /&gt;
Which permissions does the file have? Is it readable and executable?&lt;/P&gt;</description>
    <pubDate>Fri, 03 May 2019 10:56:20 GMT</pubDate>
    <dc:creator>tom_frotscher</dc:creator>
    <dc:date>2019-05-03T10:56:20Z</dc:date>
    <item>
      <title>Python SDK file upload issue</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Python-SDK-file-upload-issue/m-p/445892#M8075</link>
      <description>&lt;P&gt;I'm testing uploading a file using the Splunk Python SDK and receiving the following error :&lt;BR /&gt;
Traceback (most recent call last):&lt;BR /&gt;
  File "testConnection.py", line 50, in &lt;BR /&gt;
    myindex.upload("/opt/splunkforwarder/bin/scripts/test");&lt;BR /&gt;
  File "/home/hafahmed/splunk-sdk-python-1.6.6/splunklib/client.py", line 2106, in upload&lt;BR /&gt;
    self.service.post(path, name=filename, **kwargs)&lt;BR /&gt;
  File "/home/hafahmed/splunk-sdk-python-1.6.6/splunklib/binding.py", line 289, in wrapper&lt;BR /&gt;
    return request_fun(self, *args, **kwargs)&lt;BR /&gt;
  File "/home/hafahmed/splunk-sdk-python-1.6.6/splunklib/binding.py", line 71, in new_f&lt;BR /&gt;
    val = f(*args, **kwargs)&lt;BR /&gt;
  File "/home/hafahmed/splunk-sdk-python-1.6.6/splunklib/binding.py", line 752, in post&lt;BR /&gt;
    response = self.http.post(path, all_headers, **query)&lt;BR /&gt;
  File "/home/hafahmed/splunk-sdk-python-1.6.6/splunklib/binding.py", line 1224, in post&lt;BR /&gt;
    return self.request(url, message)&lt;BR /&gt;
  File "/home/hafahmed/splunk-sdk-python-1.6.6/splunklib/binding.py", line 1244, in request&lt;BR /&gt;
    raise HTTPError(response)&lt;BR /&gt;
splunklib.binding.HTTPError: HTTP 400 Bad Request -- unable to open file: path='/opt/splunkforwarder/bin/scripts/test' error='No such file or directory'&lt;/P&gt;

&lt;P&gt;Code snippet:&lt;BR /&gt;
myindex = service.indexes["testing"]&lt;/P&gt;

&lt;P&gt;myindex.upload("/opt/splunkforwarder/bin/scripts/test");&lt;/P&gt;

&lt;P&gt;The file exists and has the correct permissions, Any hints?&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 00:24:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Python-SDK-file-upload-issue/m-p/445892#M8075</guid>
      <dc:creator>HafizEAhmed</dc:creator>
      <dc:date>2020-09-30T00:24:51Z</dc:date>
    </item>
    <item>
      <title>Re: Python SDK file upload issue</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Python-SDK-file-upload-issue/m-p/445893#M8076</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;is there no file extention like test.sh or test.py? Looks like your path is pointing to a folder, not a file.&lt;BR /&gt;
Which permissions does the file have? Is it readable and executable?&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2019 10:56:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Python-SDK-file-upload-issue/m-p/445893#M8076</guid>
      <dc:creator>tom_frotscher</dc:creator>
      <dc:date>2019-05-03T10:56:20Z</dc:date>
    </item>
    <item>
      <title>Re: Python SDK file upload issue</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Python-SDK-file-upload-issue/m-p/445894#M8077</link>
      <description>&lt;P&gt;Your file does not have an extension. Splunk interprets files with no extension as binary files and will not ingest them.&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2019 15:43:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Python-SDK-file-upload-issue/m-p/445894#M8077</guid>
      <dc:creator>codebuilder</dc:creator>
      <dc:date>2019-05-03T15:43:01Z</dc:date>
    </item>
    <item>
      <title>Re: Python SDK file upload issue</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Python-SDK-file-upload-issue/m-p/445895#M8078</link>
      <description>&lt;P&gt;it's actually pointing to a file and it's both readable and executable &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2019 16:07:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Python-SDK-file-upload-issue/m-p/445895#M8078</guid>
      <dc:creator>HafizEAhmed</dc:creator>
      <dc:date>2019-05-03T16:07:21Z</dc:date>
    </item>
    <item>
      <title>Re: Python SDK file upload issue</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Python-SDK-file-upload-issue/m-p/445896#M8079</link>
      <description>&lt;P&gt;hmm tried changing the extension but I'm still getting the same error&lt;/P&gt;

&lt;P&gt;splunklib.binding.HTTPError: HTTP 400 Bad Request -- unable to open file: path='/opt/splunkforwarder/bin/scripts/test.txt' error='No such file or directory'&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2019 16:32:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Python-SDK-file-upload-issue/m-p/445896#M8079</guid>
      <dc:creator>HafizEAhmed</dc:creator>
      <dc:date>2019-05-03T16:32:20Z</dc:date>
    </item>
    <item>
      <title>Re: Python SDK file upload issue</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Python-SDK-file-upload-issue/m-p/445897#M8080</link>
      <description>&lt;P&gt;Is the file and directory owned by splunk? &lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2019 19:04:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Python-SDK-file-upload-issue/m-p/445897#M8080</guid>
      <dc:creator>codebuilder</dc:creator>
      <dc:date>2019-05-03T19:04:11Z</dc:date>
    </item>
    <item>
      <title>Re: Python SDK file upload issue</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Python-SDK-file-upload-issue/m-p/445898#M8081</link>
      <description>&lt;P&gt;Can you post the actual lines of python code for the upload? &lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2019 19:10:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Python-SDK-file-upload-issue/m-p/445898#M8081</guid>
      <dc:creator>tom_frotscher</dc:creator>
      <dc:date>2019-05-03T19:10:36Z</dc:date>
    </item>
    <item>
      <title>Re: Python SDK file upload issue</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Python-SDK-file-upload-issue/m-p/445899#M8082</link>
      <description>&lt;P&gt;myindex = service.indexes["testing"]&lt;BR /&gt;
uploadme = "/opt/splunkforwarder/bin/scripts/test.txt"&lt;BR /&gt;
myindex.upload(uploadme)&lt;/P&gt;</description>
      <pubDate>Sat, 04 May 2019 00:48:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Python-SDK-file-upload-issue/m-p/445899#M8082</guid>
      <dc:creator>HafizEAhmed</dc:creator>
      <dc:date>2019-05-04T00:48:30Z</dc:date>
    </item>
    <item>
      <title>Re: Python SDK file upload issue</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Python-SDK-file-upload-issue/m-p/445900#M8083</link>
      <description>&lt;P&gt;This method does not use a path, it just uses a file name as parameter. Try to change the directory,and then try to use just "text.txt" as the parameter for the upload function. You can change the directory in python with os.chdir see example here: &lt;A href="https://stackoverflow.com/questions/431684/how-do-i-change-directory-cd-in-python"&gt;https://stackoverflow.com/questions/431684/how-do-i-change-directory-cd-in-python&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Currently, you tried to upload a file that is called "opt/Splunk...." in your current working directory, that's why the file is not found. &lt;/P&gt;</description>
      <pubDate>Sat, 04 May 2019 16:30:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Python-SDK-file-upload-issue/m-p/445900#M8083</guid>
      <dc:creator>tom_frotscher</dc:creator>
      <dc:date>2019-05-04T16:30:06Z</dc:date>
    </item>
    <item>
      <title>Re: Python SDK file upload issue</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Python-SDK-file-upload-issue/m-p/445901#M8084</link>
      <description>&lt;P&gt;unable to open file it's like permission problem ? &lt;/P&gt;

&lt;P&gt;chmod a+x yourscript.py Or yourscrpit.sh &lt;/P&gt;

&lt;P&gt;can you try ? &lt;/P&gt;</description>
      <pubDate>Sat, 04 May 2019 16:34:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Python-SDK-file-upload-issue/m-p/445901#M8084</guid>
      <dc:creator>burakatabay</dc:creator>
      <dc:date>2019-05-04T16:34:30Z</dc:date>
    </item>
    <item>
      <title>Re: Python SDK file upload issue</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Python-SDK-file-upload-issue/m-p/445902#M8085</link>
      <description>&lt;P&gt;I think the problem might be where the file is located, if the file is in another server it won't work. In other words, you first need to copy the file to Splunk SH server then you can upload it.  Once the file is locally you can pass the path and call the function to upload the file.&lt;/P&gt;

&lt;P&gt;SCP the file to /tmp folder then:&lt;/P&gt;

&lt;P&gt;myindex = service.indexes["secdevops"]&lt;/P&gt;

&lt;P&gt;uploadme = "/tmp/scoring_output.csv"&lt;/P&gt;

&lt;P&gt;myindex.upload(uploadme);&lt;/P&gt;</description>
      <pubDate>Mon, 30 Dec 2019 18:49:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Python-SDK-file-upload-issue/m-p/445902#M8085</guid>
      <dc:creator>rsokolova</dc:creator>
      <dc:date>2019-12-30T18:49:02Z</dc:date>
    </item>
  </channel>
</rss>

