<?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>question Re: How to add additional libraries in ExecuteScript Processor for Python in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-add-additional-libraries-in-ExecuteScript-Processor/m-p/109761#M50687</link>
    <description>&lt;P&gt;When using the Jython script engine in ExecuteScript, the Module Directory property works somewhat like the &lt;A target="_blank" href="https://docs.python.org/2/tutorial/modules.html"&gt;standard Python module system&lt;/A&gt;. I believe you'll want to have the location(s) specified as the directories containing the scripts, not the scripts themselves. Each entry in Module Directory is added to the script engine via a "sys.path.append()" call, so if you can get the modules to load for a regular python script (using sys.path.append() with full path names), then you can use that same list for Module Directory. I'd try:&lt;/P&gt;&lt;PRE&gt;C:\Users\pjalla\AppData\Local\Programs\Python\Python35-32\Lib\site-packages\requests,C:\Users\pjalla\AppData\Local\Programs\Python\Python35-32\Lib\json,C:\Users\pjalla\AppData\Local\Programs\Python\Python35-32\Lib\site-packages\requests_oauthlib&lt;/PRE&gt;&lt;P&gt;or whichever variations to avoid the drive letter, backslashes, etc.&lt;/P&gt;&lt;P&gt;In &lt;A target="_blank" href="https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-scripting-bundle/nifi-scripting-processors/src/test/java/org/apache/nifi/processors/script/TestInvokeJython.java#L102"&gt;this unit test&lt;/A&gt; you can see the Module Directory set to a &lt;A target="_blank" href="https://github.com/apache/nifi/tree/master/nifi-nar-bundles/nifi-scripting-bundle/nifi-scripting-processors/src/test/resources/jython"&gt;test resources folder&lt;/A&gt;, the test uses "from callbacks import ReadFirstLine", and there are .py files in the "callbacks" folder under the test resources folder specified as Module Directory. Hopefully you can use a similar approach to have the script engine find the folders/locations and import the corresponding code.&lt;/P&gt;</description>
    <pubDate>Wed, 04 Jan 2017 01:43:16 GMT</pubDate>
    <dc:creator>mburgess</dc:creator>
    <dc:date>2017-01-04T01:43:16Z</dc:date>
    <item>
      <title>How to add additional libraries in ExecuteScript Processor for Python</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-add-additional-libraries-in-ExecuteScript-Processor/m-p/109760#M50686</link>
      <description>&lt;P&gt;Greetings Community , &lt;/P&gt;&lt;P&gt;I am working on a python scipt , which uses http post request to get data .&lt;/P&gt;&lt;P&gt;I have used invokehttp processor and worked hard to get data using it , but later figured out that there are some authentication libraries by the API developer . So I need to execute the specific python code provided by API developer to get data.&lt;/P&gt;&lt;P&gt;Now , I am trying to run the &lt;STRONG&gt;python code&lt;/STRONG&gt; with &lt;STRONG&gt;&lt;U&gt;some additional libraries&lt;/U&gt;&lt;/STRONG&gt; . &lt;/P&gt;&lt;P&gt;I have taken reference of below link where in groovy additional libraries are hosted in local directory and path is mentioned in &lt;STRONG&gt;MODULE DIRECTORY in ExecuteScript Processor&lt;/STRONG&gt;. &lt;/P&gt;&lt;P&gt;&lt;A href="https://community.hortonworks.com/questions/47493/nifi-executescript-using-external-libarries-with-g.html" target="_blank"&gt;https://community.hortonworks.com/questions/47493/nifi-executescript-using-external-libarries-with-g.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I am doing the same by  specifiying the python libraries location (folder location)  using  comma separated &lt;/P&gt;&lt;P&gt;Tried forward and back slash as well while specifying folder location  , even tried specifying the main python file ( __init.py__) but for all these attempts the error is as follows &lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;No Module named xxx NOT FOUND in line XXX .&lt;/STRONG&gt;
  
Here is the what I mentioned in &lt;STRONG&gt;Module Directory &lt;/STRONG&gt;in &lt;STRONG&gt;ExectuteScript&lt;/STRONG&gt; Processor. &lt;/P&gt;&lt;P&gt;
C:\Users\pjalla\AppData\Local\Programs\Python\Python35-32\Lib\site-packages\requests\__init__.py,C:\Users\pjalla\AppData\Local\Programs\Python\Python35-32\Lib\json\__init__.py,C:\Users\pjalla\AppData\Local\Programs\Python\Python35-32\Lib\site-packages\requests_oauthlib\oauth1_auth.py,C:\Users\pjalla\AppData\Local\Programs\Python\Python35-32\Lib\site-packages\requests_oauthlib\oauth1_session.py&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jan 2017 00:49:40 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-add-additional-libraries-in-ExecuteScript-Processor/m-p/109760#M50686</guid>
      <dc:creator>pavankumar_jall</dc:creator>
      <dc:date>2017-01-04T00:49:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to add additional libraries in ExecuteScript Processor for Python</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-add-additional-libraries-in-ExecuteScript-Processor/m-p/109761#M50687</link>
      <description>&lt;P&gt;When using the Jython script engine in ExecuteScript, the Module Directory property works somewhat like the &lt;A target="_blank" href="https://docs.python.org/2/tutorial/modules.html"&gt;standard Python module system&lt;/A&gt;. I believe you'll want to have the location(s) specified as the directories containing the scripts, not the scripts themselves. Each entry in Module Directory is added to the script engine via a "sys.path.append()" call, so if you can get the modules to load for a regular python script (using sys.path.append() with full path names), then you can use that same list for Module Directory. I'd try:&lt;/P&gt;&lt;PRE&gt;C:\Users\pjalla\AppData\Local\Programs\Python\Python35-32\Lib\site-packages\requests,C:\Users\pjalla\AppData\Local\Programs\Python\Python35-32\Lib\json,C:\Users\pjalla\AppData\Local\Programs\Python\Python35-32\Lib\site-packages\requests_oauthlib&lt;/PRE&gt;&lt;P&gt;or whichever variations to avoid the drive letter, backslashes, etc.&lt;/P&gt;&lt;P&gt;In &lt;A target="_blank" href="https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-scripting-bundle/nifi-scripting-processors/src/test/java/org/apache/nifi/processors/script/TestInvokeJython.java#L102"&gt;this unit test&lt;/A&gt; you can see the Module Directory set to a &lt;A target="_blank" href="https://github.com/apache/nifi/tree/master/nifi-nar-bundles/nifi-scripting-bundle/nifi-scripting-processors/src/test/resources/jython"&gt;test resources folder&lt;/A&gt;, the test uses "from callbacks import ReadFirstLine", and there are .py files in the "callbacks" folder under the test resources folder specified as Module Directory. Hopefully you can use a similar approach to have the script engine find the folders/locations and import the corresponding code.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jan 2017 01:43:16 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-add-additional-libraries-in-ExecuteScript-Processor/m-p/109761#M50687</guid>
      <dc:creator>mburgess</dc:creator>
      <dc:date>2017-01-04T01:43:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to add additional libraries in ExecuteScript Processor for Python</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-add-additional-libraries-in-ExecuteScript-Processor/m-p/109762#M50688</link>
      <description>&lt;P&gt;Thanks for reply Matt , I carefully read your reply , I only find &lt;B&gt;python &lt;/B&gt;execute engine but not &lt;B&gt;jython &lt;/B&gt;processor in both &lt;B&gt;ExectuteScript &lt;/B&gt;and &lt;B&gt;InvokeScriptedProcessor&lt;/B&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jan 2017 03:00:09 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-add-additional-libraries-in-ExecuteScript-Processor/m-p/109762#M50688</guid>
      <dc:creator>pavankumar_jall</dc:creator>
      <dc:date>2017-01-04T03:00:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to add additional libraries in ExecuteScript Processor for Python</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-add-additional-libraries-in-ExecuteScript-Processor/m-p/109763#M50689</link>
      <description>&lt;P&gt;ExecuteScript uses the name provided by the script engine to display to the user. The Jython script engine chose "python" as the language name, so that is the correct choice. One major difference is that with Jython you can only include pure Python (.py) modules, not natively-compiled modules like numpy/scipy.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jan 2017 10:33:23 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-add-additional-libraries-in-ExecuteScript-Processor/m-p/109763#M50689</guid>
      <dc:creator>mburgess</dc:creator>
      <dc:date>2017-01-04T10:33:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to add additional libraries in ExecuteScript Processor for Python</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-add-additional-libraries-in-ExecuteScript-Processor/m-p/109764#M50690</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/641/mburgess.html" nodeid="641"&gt;@Matt Burgess&lt;/A&gt; &lt;/P&gt;&lt;P&gt;Is there a way of either adding non-pure Python modules or otherwise force the script to run under a predefined environment (e.g. a local anaconda environment)?&lt;/P&gt;</description>
      <pubDate>Sun, 25 Mar 2018 06:50:56 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-add-additional-libraries-in-ExecuteScript-Processor/m-p/109764#M50690</guid>
      <dc:creator>vincentvanouden</dc:creator>
      <dc:date>2018-03-25T06:50:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to add additional libraries in ExecuteScript Processor for Python</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-add-additional-libraries-in-ExecuteScript-Processor/m-p/109765#M50691</link>
      <description>&lt;P&gt;No, you'd have to use ExecuteStreamCommand or ExecuteProcess for things like Anaconda environments, non-pure (CPython) modules, etc.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Mar 2018 22:28:40 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-add-additional-libraries-in-ExecuteScript-Processor/m-p/109765#M50691</guid>
      <dc:creator>mburgess</dc:creator>
      <dc:date>2018-03-26T22:28:40Z</dc:date>
    </item>
  </channel>
</rss>

