<?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 Adding external library to custom app in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Adding-external-library-to-custom-app/m-p/527459#M9436</link>
    <description>&lt;P&gt;I would like to use &lt;A href="https://pypi.org/project/keyring/" target="_blank" rel="noopener"&gt;https://pypi.org/project/keyring/&lt;/A&gt; in my custom app. I've been able to do it on Linux but unable to on Windows.&lt;/P&gt;&lt;P&gt;I need pip to install it. I tried calling python from the Splunk provided one, but it won't work. I ended up installing the latest Python on my server to pull it. Even when installed and I install keyring, it can't be found. I've tried using &lt;EM&gt;sys.path.append &lt;/EM&gt;but has not helped. I've tried placing the downloaded package (from C:\Users\{username}\AppData\Local\Programs\Python\Python39\Lib\site-packages) in my bin folder.&lt;/P&gt;&lt;P&gt;When I run &lt;EM&gt;splunk cmd python myscript.py&lt;/EM&gt;, I get&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;Traceback (most recent call last):&lt;BR /&gt;File "C:\Program Files\Splunk\etc\apps\customapp1\bin\myscript.py", line 10, in &amp;lt;module&amp;gt;&lt;BR /&gt;import keyring&lt;BR /&gt;File "C:\Program Files\Splunk\etc\apps\customapp1\bin\keyring\__init__.py", line 1, in &amp;lt;module&amp;gt;&lt;BR /&gt;from .core import (&lt;BR /&gt;File "C:\Program Files\Splunk\etc\apps\customapp1\bin\keyring\core.py", line 10, in &amp;lt;module&amp;gt;&lt;BR /&gt;from . import backend&lt;BR /&gt;File "C:\Program Files\Splunk\etc\apps\customapp1\bin\keyring\backend.py", line 42&lt;BR /&gt;class KeyringBackend(metaclass=KeyringBackendMeta):&lt;BR /&gt;^&lt;BR /&gt;SyntaxError: invalid syntax&lt;/P&gt;&lt;P&gt;I'll also note that &lt;EM&gt;splunk cmd python myscript.py&lt;/EM&gt; only works if I specify the scripts full path. (This has no trouble on my Linux one.) Otherwise, I get &lt;EM&gt;python: can't open file 'myscript.py': [Errno 2] No such file or directory&lt;/EM&gt;. I have a Windows environment variable named "SPLUNK_HOME" set to "C:\Program Files\Splunk".&lt;/P&gt;</description>
    <pubDate>Sun, 01 Nov 2020 22:05:09 GMT</pubDate>
    <dc:creator>tmontney</dc:creator>
    <dc:date>2020-11-01T22:05:09Z</dc:date>
    <item>
      <title>Adding external library to custom app</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Adding-external-library-to-custom-app/m-p/527459#M9436</link>
      <description>&lt;P&gt;I would like to use &lt;A href="https://pypi.org/project/keyring/" target="_blank" rel="noopener"&gt;https://pypi.org/project/keyring/&lt;/A&gt; in my custom app. I've been able to do it on Linux but unable to on Windows.&lt;/P&gt;&lt;P&gt;I need pip to install it. I tried calling python from the Splunk provided one, but it won't work. I ended up installing the latest Python on my server to pull it. Even when installed and I install keyring, it can't be found. I've tried using &lt;EM&gt;sys.path.append &lt;/EM&gt;but has not helped. I've tried placing the downloaded package (from C:\Users\{username}\AppData\Local\Programs\Python\Python39\Lib\site-packages) in my bin folder.&lt;/P&gt;&lt;P&gt;When I run &lt;EM&gt;splunk cmd python myscript.py&lt;/EM&gt;, I get&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;Traceback (most recent call last):&lt;BR /&gt;File "C:\Program Files\Splunk\etc\apps\customapp1\bin\myscript.py", line 10, in &amp;lt;module&amp;gt;&lt;BR /&gt;import keyring&lt;BR /&gt;File "C:\Program Files\Splunk\etc\apps\customapp1\bin\keyring\__init__.py", line 1, in &amp;lt;module&amp;gt;&lt;BR /&gt;from .core import (&lt;BR /&gt;File "C:\Program Files\Splunk\etc\apps\customapp1\bin\keyring\core.py", line 10, in &amp;lt;module&amp;gt;&lt;BR /&gt;from . import backend&lt;BR /&gt;File "C:\Program Files\Splunk\etc\apps\customapp1\bin\keyring\backend.py", line 42&lt;BR /&gt;class KeyringBackend(metaclass=KeyringBackendMeta):&lt;BR /&gt;^&lt;BR /&gt;SyntaxError: invalid syntax&lt;/P&gt;&lt;P&gt;I'll also note that &lt;EM&gt;splunk cmd python myscript.py&lt;/EM&gt; only works if I specify the scripts full path. (This has no trouble on my Linux one.) Otherwise, I get &lt;EM&gt;python: can't open file 'myscript.py': [Errno 2] No such file or directory&lt;/EM&gt;. I have a Windows environment variable named "SPLUNK_HOME" set to "C:\Program Files\Splunk".&lt;/P&gt;</description>
      <pubDate>Sun, 01 Nov 2020 22:05:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Adding-external-library-to-custom-app/m-p/527459#M9436</guid>
      <dc:creator>tmontney</dc:creator>
      <dc:date>2020-11-01T22:05:09Z</dc:date>
    </item>
  </channel>
</rss>

