<?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: NiFi 2.0.0 - Custom Python Processor Uploading Issue in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/NiFi-2-0-0-Custom-Python-Processor-Uploading-Issue/m-p/395162#M248874</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;A class="dcxa-lithium-link" href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/80381" target="_blank"&gt;&lt;SPAN&gt;SAMSAL&lt;/SPAN&gt;&lt;/A&gt;,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the recommendation. I tried just doing the python extension and it worked. However, when I compile the nar again it still doesn't show up.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you try it with this .py file I am pasting below?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;Filename - TransformOpenskyStates.py&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from nifiapi.flowfiletransform import (
    FlowFileTransform,
    FlowFileTransformResult
)
from nifiapi.properties import ProcessContext
import json

FIELD_MAP = [
    "icao24", "callsign", "origin_country", "time_position", "last_contact",
    "longitude", "latitude", "baro_altitude", "on_ground", "velocity",
    "true_track", "vertical_rate", "sensors", "geo_altitude", "squawk",
    "spi", "position_source"
]

RETURN_SCHEMA = [
    "icao24", "callsign", "origin_country",
    "reporting_time", "time_position", "last_contact",
    "longitude", "latitude", "on_ground"
]


class TransformOpenskyStates(FlowFileTransform):

    class Java:
        implements = ['org.apache.nifi.python.processor.FlowFileTransform']

    class ProcessorDetails:
        version = '0.0.1-SNAPSHOT'
        description = '''
        Transform the data returned by the OpenSky Network API.
        '''
        tags = ["opensky", "transform", "tutorial"]
        dependencies = []

    def __init__(self, **kwargs):
        super().__init__()

    def transform(
        self, context: ProcessContext, flow_file
    ) -&amp;gt; FlowFileTransformResult:
        '''
        Parameters:
            context (ProcessContext)
            flow_file

        Returns:
            FlowFileTransformResult
        '''
        contents = json.loads(flow_file.getContentsAsBytes())

        def sanitize_value(value):
            if isinstance(value, str):
                return value.strip()

            return value

        states = []
        for record in contents["states"]:
            record = dict(zip(FIELD_MAP, record))
            record["reporting_time"] = contents["time"]

            # Choose only fields listed in the RETURN_SCHEMA
            sanitized = {}
            for key, value in record.items():
                if key not in RETURN_SCHEMA:
                    continue

                sanitized[key] = sanitize_value(value)

            states.append(sanitized)

        return FlowFileTransformResult(
            "success",
            contents=json.dumps(states)
        )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 14 Oct 2024 19:57:44 GMT</pubDate>
    <dc:creator>drewski7</dc:creator>
    <dc:date>2024-10-14T19:57:44Z</dc:date>
    <item>
      <title>NiFi 2.0.0 - Custom Python Processor Uploading Issue</title>
      <link>https://community.cloudera.com/t5/Support-Questions/NiFi-2-0-0-Custom-Python-Processor-Uploading-Issue/m-p/394709#M248786</link>
      <description>&lt;P&gt;All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I created a new processor using python3.12 in NiFi 2.0.0 M4 release of NiFi.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My directory structure looks like this based on the documentation -&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="drewski7_0-1728323942308.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/42028iA705C9BED8B498A7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="drewski7_0-1728323942308.png" alt="drewski7_0-1728323942308.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I don't include anything under bundled dependencies and my MANIFEST.MF looks like this.&lt;/P&gt;&lt;PRE&gt;Manifest-Version: 1.0&lt;BR /&gt;Build-Timestamp: 2024-10-07T16:22:20Z&lt;BR /&gt;Nar-Id: processors-nar&lt;BR /&gt;Nar-Group: processors&lt;BR /&gt;Nar-Version: 0.0.2&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;I zipped everything and created a .nar called TransformOpenskyStates.nar. Once created, I added it to my NiFi_home/extensions directory.&lt;/P&gt;&lt;P&gt;After looking in the logs, I see this -&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;2024-10-07 13:44:34,481 INFO [NAR Auto-Loader] org.apache.nifi.nar.NarAutoLoaderTask Found ./extensions/TransformOpenskyStates.nar in auto-load directory&lt;BR /&gt;2024-10-07 13:44:39,487 INFO [NAR Auto-Loader] org.apache.nifi.nar.StandardNarLoader Starting load process for 1 NARs...&lt;BR /&gt;2024-10-07 13:44:39,494 INFO [NAR Auto-Loader] org.apache.nifi.nar.StandardNarLoader Creating class loaders for 1 NARs...&lt;BR /&gt;2024-10-07 13:44:39,496 INFO [NAR Auto-Loader] org.apache.nifi.nar.NarClassLoaders Loaded NAR file: /Users/drewnicolette/Downloads/nifi-2.0.0-M4/./work/nar/extensions/TransformOpenskyStates.nar-unpacked as class loader org.apache.nifi.nar.NarClassLoader[./work/nar/extensions/TransformOpenskyStates.nar-unpacked]&lt;BR /&gt;2024-10-07 13:44:39,496 INFO [NAR Auto-Loader] org.apache.nifi.nar.StandardNarLoader Successfully created class loaders for 1 NARs, 0 were skipped&lt;BR /&gt;2024-10-07 13:44:39,498 INFO [NAR Auto-Loader] o.a.n.n.StandardExtensionDiscoveringManager Loaded extensions for processors:processors-nar:0.0.2 in 2 millis&lt;BR /&gt;2024-10-07 13:44:39,499 INFO [NAR Auto-Loader] org.apache.nifi.nar.StandardNarLoader Finished NAR loading process!&lt;/PRE&gt;&lt;P&gt;But I can't find my processor in the UI/Canvas at all.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone know the issue?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Oct 2024 18:02:53 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/NiFi-2-0-0-Custom-Python-Processor-Uploading-Issue/m-p/394709#M248786</guid>
      <dc:creator>drewski7</dc:creator>
      <dc:date>2024-10-07T18:02:53Z</dc:date>
    </item>
    <item>
      <title>Re: NiFi 2.0.0 - Custom Python Processor Uploading Issue</title>
      <link>https://community.cloudera.com/t5/Support-Questions/NiFi-2-0-0-Custom-Python-Processor-Uploading-Issue/m-p/395076#M248857</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/80381"&gt;@SAMSAL&lt;/a&gt;&amp;nbsp; - Can you help out with this?&lt;/P&gt;</description>
      <pubDate>Sat, 12 Oct 2024 18:11:08 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/NiFi-2-0-0-Custom-Python-Processor-Uploading-Issue/m-p/395076#M248857</guid>
      <dc:creator>drewski7</dc:creator>
      <dc:date>2024-10-12T18:11:08Z</dc:date>
    </item>
    <item>
      <title>Re: NiFi 2.0.0 - Custom Python Processor Uploading Issue</title>
      <link>https://community.cloudera.com/t5/Support-Questions/NiFi-2-0-0-Custom-Python-Processor-Uploading-Issue/m-p/395094#M248863</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/79092"&gt;@drewski7&lt;/a&gt; ,&lt;/P&gt;&lt;P&gt;I never tried this before but I decided to give a shot. What I did is I to take a Python Extension Sample like &lt;A href="https://github.com/apache/nifi-python-extensions/blob/main/src/extensions/chunking/ChunkDocument.py" target="_self"&gt;ChunkDocument&lt;/A&gt; and add it as regular python extension just to get all dependencies downloaded. After that I created the folder structure similar to what you have:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;my-nar.nar
+-- META-INF/
    +-- MANIFEST.MF
+-- NAR-INF/
    +-- bundled-dependencies/
        +-- dependency1
        +-- dependency2
        +-- etc.
+-- MyProcessor.py&lt;/LI-CODE&gt;&lt;P&gt;Then I followed the following steps:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;I copied all the downloaded dependencies to NAR-INF/bundled-dependencies&lt;/LI&gt;&lt;LI&gt;I created a MANIFEST.MF and copied the same info you have provided under META-INF/&lt;/LI&gt;&lt;LI&gt;I copied the ChunkDocument.py and then rename it to MFChunkDocument.py (I will explain later why I renamed to MFCh...)&amp;nbsp; to be on the root level similar to where you have&amp;nbsp; your custom TransformOpenskyStates.py.&lt;/LI&gt;&lt;LI&gt;I Zipped the file and called it to "nifi-ChunkDocument-nar.zip"&lt;/LI&gt;&lt;LI&gt;I rename from .zip to&amp;nbsp; .nar and copied to&amp;nbsp; NIFI-HOME/lib .&amp;nbsp; I think you copied it under NIFI-HOME/extensions which should work as well.&lt;/LI&gt;&lt;LI&gt;I deleted the created python extension for the same processor under work/python/extension to download all dependencies earlier.&lt;/LI&gt;&lt;LI&gt;When I launched Nifi Im able to find the processor and set it up accordingly.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;The reason I renamed the file from ChunkDocument to MFChunkDocument because there seem to be a bug. Please refer to my comment &lt;A href="https://github.com/apache/nifi/pull/8573" target="_self"&gt;here&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;I dont see anything wrong with what you did. However you mentioned your did not include&amp;nbsp; anything under&amp;nbsp; bundled-dependencies ....is this because you dont have any? if you do then you should copy all these dependencies. If that is not the issue , I would look into the processor itself and just for sake of testing add as python extension (not as NAR) to see if it works, if it doesnt then there is something wrong with the processor itself. If you want you can email a copy of your py file and I can try it from my end.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope that helps. If it does, please accept solution.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 13 Oct 2024 23:31:38 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/NiFi-2-0-0-Custom-Python-Processor-Uploading-Issue/m-p/395094#M248863</guid>
      <dc:creator>SAMSAL</dc:creator>
      <dc:date>2024-10-13T23:31:38Z</dc:date>
    </item>
    <item>
      <title>Re: NiFi 2.0.0 - Custom Python Processor Uploading Issue</title>
      <link>https://community.cloudera.com/t5/Support-Questions/NiFi-2-0-0-Custom-Python-Processor-Uploading-Issue/m-p/395162#M248874</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;A class="dcxa-lithium-link" href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/80381" target="_blank"&gt;&lt;SPAN&gt;SAMSAL&lt;/SPAN&gt;&lt;/A&gt;,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the recommendation. I tried just doing the python extension and it worked. However, when I compile the nar again it still doesn't show up.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you try it with this .py file I am pasting below?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;Filename - TransformOpenskyStates.py&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from nifiapi.flowfiletransform import (
    FlowFileTransform,
    FlowFileTransformResult
)
from nifiapi.properties import ProcessContext
import json

FIELD_MAP = [
    "icao24", "callsign", "origin_country", "time_position", "last_contact",
    "longitude", "latitude", "baro_altitude", "on_ground", "velocity",
    "true_track", "vertical_rate", "sensors", "geo_altitude", "squawk",
    "spi", "position_source"
]

RETURN_SCHEMA = [
    "icao24", "callsign", "origin_country",
    "reporting_time", "time_position", "last_contact",
    "longitude", "latitude", "on_ground"
]


class TransformOpenskyStates(FlowFileTransform):

    class Java:
        implements = ['org.apache.nifi.python.processor.FlowFileTransform']

    class ProcessorDetails:
        version = '0.0.1-SNAPSHOT'
        description = '''
        Transform the data returned by the OpenSky Network API.
        '''
        tags = ["opensky", "transform", "tutorial"]
        dependencies = []

    def __init__(self, **kwargs):
        super().__init__()

    def transform(
        self, context: ProcessContext, flow_file
    ) -&amp;gt; FlowFileTransformResult:
        '''
        Parameters:
            context (ProcessContext)
            flow_file

        Returns:
            FlowFileTransformResult
        '''
        contents = json.loads(flow_file.getContentsAsBytes())

        def sanitize_value(value):
            if isinstance(value, str):
                return value.strip()

            return value

        states = []
        for record in contents["states"]:
            record = dict(zip(FIELD_MAP, record))
            record["reporting_time"] = contents["time"]

            # Choose only fields listed in the RETURN_SCHEMA
            sanitized = {}
            for key, value in record.items():
                if key not in RETURN_SCHEMA:
                    continue

                sanitized[key] = sanitize_value(value)

            states.append(sanitized)

        return FlowFileTransformResult(
            "success",
            contents=json.dumps(states)
        )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Oct 2024 19:57:44 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/NiFi-2-0-0-Custom-Python-Processor-Uploading-Issue/m-p/395162#M248874</guid>
      <dc:creator>drewski7</dc:creator>
      <dc:date>2024-10-14T19:57:44Z</dc:date>
    </item>
    <item>
      <title>Re: NiFi 2.0.0 - Custom Python Processor Uploading Issue</title>
      <link>https://community.cloudera.com/t5/Support-Questions/NiFi-2-0-0-Custom-Python-Processor-Uploading-Issue/m-p/395178#M248877</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/79092"&gt;@drewski7&lt;/a&gt; ,&lt;/P&gt;&lt;P&gt;I tried the code you have posted and it worked for me !&lt;/P&gt;&lt;P&gt;Here are the steps I followed:&lt;/P&gt;&lt;P&gt;1- Create Main Folder called &lt;STRONG&gt;TransformOpenskyStates-nar&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;2- Created&amp;nbsp; &lt;STRONG&gt;TransformOpenskyStates.py&lt;/STRONG&gt; with the code you posted&amp;nbsp; under the main folder above.&lt;/P&gt;&lt;P&gt;3- Created the folder structure as follows:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SAMSAL_0-1728948714734.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/42122iC74B17FB3185A93A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SAMSAL_0-1728948714734.png" alt="SAMSAL_0-1728948714734.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3 - Under the &lt;STRONG&gt;META-INF&lt;/STRONG&gt; I have created the &lt;STRONG&gt;MANIFEST.FM&lt;/STRONG&gt; and add the following text:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Manifest-Version: 1.0
Build-Timestamp: 2024-10-07T16:22:20Z
Nar-Id: TransformOpenskyStates-nar
Nar-Group: nifi.py.processors
Nar-Version: 0.0.2&lt;/LI-CODE&gt;&lt;P&gt;4- Under &lt;STRONG&gt;NAR-INF&lt;/STRONG&gt; I have created an Empty folder of "&lt;STRONG&gt;bundled-dependencies&lt;/STRONG&gt;" since you dont seem to have any external dependencies.&lt;/P&gt;&lt;P&gt;5-&amp;nbsp; I have downloaded and installed &lt;STRONG&gt;7-zip&lt;/STRONG&gt; then I went inside the main directory created at step 1 , selected all (2 folders and 1 py file) , right click , select 7-Zip menu item and then select Add to Archive&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SAMSAL_2-1728950178329.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/42124i62EECBFCFC10F5BB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SAMSAL_2-1728950178329.png" alt="SAMSAL_2-1728950178329.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;6- In the &lt;STRONG&gt;7-Zip Add To Archive&lt;/STRONG&gt; window,&amp;nbsp; type the name of your package and save as .zip. No need to change any configuration. &lt;U&gt;&lt;STRONG&gt;If you create a zip file on the main folder level then it will add the main folder to the package and that might cause problem as nifi expects the py file to be on the root level and that could be your probelm.&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SAMSAL_3-1728950343034.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/42125i4A0FCB239AD490C9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SAMSAL_3-1728950343034.png" alt="SAMSAL_3-1728950343034.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;7- &lt;STRONG&gt;rename the .zip to .nar&lt;/STRONG&gt; and then I would try first to place it under the&lt;STRONG&gt; lib folder&lt;/STRONG&gt; and if it works you can move it to others.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SAMSAL_5-1728950499154.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/42127iB0437973ED0B4C01/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SAMSAL_5-1728950499154.png" alt="SAMSAL_5-1728950499154.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;8 - Restart Nifi and in my case the &lt;STRONG&gt;log file&lt;/STRONG&gt; had the following entries regarding this processor:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;2024-10-14 20:10:00,495 INFO [main] org.apache.nifi.nar.NarClassLoaders Loaded NAR file: \nifi-2.0.0-M4-dev\.\work\nar\extensions\TransformOpenskyStates-nar.nar-unpacked as class loader org.apache.nifi.nar.NarClassLoader[.\work\nar\extensions\TransformOpenskyStates-nar.nar-unpacked]
...
2024-10-14 20:10:02,036 INFO [main] o.a.n.n.StandardExtensionDiscoveringManager Loaded extensions for nifi.py.processors:TransformOpenskyStates-nar:0.0.2 in 3 millis
...
2024-10-14 20:10:14,316 INFO [main] o.a.n.n.StandardExtensionDiscoveringManager Discovered Python Processor TransformOpenskyStates&lt;/LI-CODE&gt;&lt;P&gt;9- Once UI is up and running , I m able to see and select the processor:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SAMSAL_6-1728951208155.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/42128iEDEDB6CE6A9DC559/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SAMSAL_6-1728951208155.png" alt="SAMSAL_6-1728951208155.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;When I ran it however I got an error but that is a different story &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SAMSAL_7-1728951313278.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/42129i1D2862C950BC6F4D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SAMSAL_7-1728951313278.png" alt="SAMSAL_7-1728951313278.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Error Message:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;20:14:13 EDT
ERROR
8d85ee2d-0192-1000-7594-fe7475f52c1d
PythonProcessor[type=TransformOpenskyStates, id=8d85ee2d-0192-1000-7594-fe7475f52c1d] Failed to transform FlowFile[filename=e8370eae-8bdd-4867-91dc-1416fd5d4727]: py4j.Py4JException: An exception was raised by the Python Proxy. Return Message: Traceback (most recent call last):
  File "F:\nifi-2.0.0-M4-dev\python\framework\py4j\java_gateway.py", line 2466, in _call_proxy
    return_value = getattr(self.pool[obj_id], method)(*params)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "F:\nifi-2.0.0-M4-dev\python\api\nifiapi\flowfiletransform.py", line 33, in transformFlowFile
    return self.transform(self.process_context, flowfile)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "F:\nifi-2.0.0-M4-dev\.\work\nar\extensions\TransformOpenskyStates-nar.nar-unpacked\TransformOpenskyStates.py", line 49, in transform
    contents = json.loads(flow_file.getContentsAsBytes())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python\311\Lib\json\__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python\311\Lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python\311\Lib\json\decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)&lt;/LI-CODE&gt;&lt;P&gt;Im emailing you a copy of the zip file . Try to change it to nar and see if that works. Im suspecting that the way you package (zip) the folder structure is causing the issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope that helps.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Oct 2024 00:21:32 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/NiFi-2-0-0-Custom-Python-Processor-Uploading-Issue/m-p/395178#M248877</guid>
      <dc:creator>SAMSAL</dc:creator>
      <dc:date>2024-10-15T00:21:32Z</dc:date>
    </item>
    <item>
      <title>Re: NiFi 2.0.0 - Custom Python Processor Uploading Issue</title>
      <link>https://community.cloudera.com/t5/Support-Questions/NiFi-2-0-0-Custom-Python-Processor-Uploading-Issue/m-p/395336#M248923</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/80381"&gt;@SAMSAL&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks so much - Here are my further findings...&lt;/P&gt;&lt;P&gt;Here is my current directory structure -&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="drewski7_1-1729100915896.png" style="width: 703px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/42162iD10C648B2300CECB/image-dimensions/703x55?v=v2" width="703" height="55" role="button" title="drewski7_1-1729100915896.png" alt="drewski7_1-1729100915896.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I tried a bunch of different ways to zip this and put the .nar in the corresponding NIFI_HOME/lib directory.&lt;BR /&gt;&lt;BR /&gt;Here is each test case running on my Mac OS. Please ignore the naming conventions as I was trying to go through this quickly&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;STRONG&gt;Test Case 1: Normal zip&amp;nbsp;&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;Failed&lt;/STRONG&gt;&lt;/DIV&gt;&lt;PRE&gt;zip -r archive_name.zip TransformOpenskyStates.py NAR-INF/ META-INF/&lt;BR /&gt;cp archive_name.zip ../Downloads/nifi-2.0.0-M4/lib/archive_name.nar&lt;/PRE&gt;&lt;DIV&gt;Restarting NiFi logs:&lt;/DIV&gt;&lt;PRE&gt;2024-10-15 15:52:07,787 ERROR [main] org.apache.nifi.web.server.JettyServer Failed to start web server... shutting down.&lt;BR /&gt;java.lang.NullPointerException: Cannot invoke "org.apache.nifi.nar.ExtensionMapping.size()" because "extensionMapping" is null&lt;BR /&gt;&lt;SPAN&gt; at org.apache.nifi.documentation.DocGenerator.generate(DocGenerator.java:64)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at org.apache.nifi.web.server.JettyServer.start(JettyServer.java:833)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at org.apache.nifi.NiFi.&amp;lt;init&amp;gt;(NiFi.java:172)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at org.apache.nifi.NiFi.&amp;lt;init&amp;gt;(NiFi.java:83)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at org.apache.nifi.NiFi.main(NiFi.java:332)&lt;/SPAN&gt;&lt;/PRE&gt;&lt;DIV&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;Test Case 2: Excluding Mac OS metadata files in Zip Command&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;Failed&amp;nbsp;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/DIV&gt;&lt;PRE&gt;zip -r archive_name.zip TransformOpenskyStates.py NAR-INF/ META-INF/ -x "*.DS_Store" -x "__MACOSX/*"&lt;BR /&gt;cp archive_name.zip ../Downloads/nifi-2.0.0-M4/lib/archive_name.nar&lt;/PRE&gt;&lt;DIV&gt;Restarting NiFi logs:&lt;/DIV&gt;&lt;PRE&gt;2024-10-15 15:52:07,787 ERROR [main] org.apache.nifi.web.server.JettyServer Failed to start web server... shutting down.&lt;BR /&gt;java.lang.NullPointerException: Cannot invoke "org.apache.nifi.nar.ExtensionMapping.size()" because "extensionMapping" is null&lt;BR /&gt;&lt;SPAN&gt; at org.apache.nifi.documentation.DocGenerator.generate(DocGenerator.java:64)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at org.apache.nifi.web.server.JettyServer.start(JettyServer.java:833)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at org.apache.nifi.NiFi.&amp;lt;init&amp;gt;(NiFi.java:172)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at org.apache.nifi.NiFi.&amp;lt;init&amp;gt;(NiFi.java:83)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; at org.apache.nifi.NiFi.main(NiFi.java:332)&lt;/SPAN&gt;&lt;/PRE&gt;&lt;DIV&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;Test Case 3: Normal Zip Command Outer Folder&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;Failed&amp;nbsp;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/DIV&gt;&lt;PRE&gt;zip -r test.zip TransformOS-nar/&lt;BR /&gt;cp test.zip ../Downloads/nifi-2.0.0-M4/lib/archive_name.nar&lt;/PRE&gt;&lt;DIV&gt;Restarting NiFi logs:&lt;/DIV&gt;&lt;PRE&gt;java.lang.NullPointerException: Cannot invoke "java.util.jar.Manifest.getMainAttributes()" because "manifest" is null&lt;BR /&gt;   at org.apache.nifi.nar.NarUnpacker.createBundleCoordinate(NarUnpacker.java:258)&lt;BR /&gt;   at org.apache.nifi.nar.NarUnpacker.unpackNars(NarUnpacker.java:140)&lt;BR /&gt;   at org.apache.nifi.nar.NarUnpacker.unpackNars(NarUnpacker.java:90).  &lt;BR /&gt;   at org.apache.nifi.nar.NarUnpacker.unpackNars(NarUnpacker.java:84)&lt;BR /&gt;   at org.apache.nifi.nar.NarUnpacker.unpackNars(NarUnpacker.java:75)&lt;BR /&gt;   at org.apache.nifi.NiFi.&amp;lt;init&amp;gt;(NiFi.java:142)&lt;BR /&gt;   at org.apache.nifi.NiFi.&amp;lt;init&amp;gt;(NiFi.java:83)&lt;BR /&gt;   at org.apache.nifi.NiFi.main(NiFi.java:332)&lt;/PRE&gt;&lt;DIV&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;Test Case 4: Normal Zip Command Outer Folder with exclusions&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;Failed&amp;nbsp;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/DIV&gt;&lt;PRE&gt;zip -r archive_name.zip TransformOS-nar/ -x "*.DS_Store" -x "__MACOSX/*"&lt;BR /&gt;cp archive_name.zip ../Downloads/nifi-2.0.0-M4/lib/archive_name.nar&lt;/PRE&gt;&lt;DIV&gt;Restarting NiFi logs:&lt;/DIV&gt;&lt;PRE&gt;java.lang.NullPointerException: Cannot invoke "java.util.jar.Manifest.getMainAttributes()" because "manifest" is null&lt;BR /&gt;   at org.apache.nifi.nar.NarUnpacker.createBundleCoordinate(NarUnpacker.java:258)&lt;BR /&gt;   at org.apache.nifi.nar.NarUnpacker.unpackNars(NarUnpacker.java:140)&lt;BR /&gt;   at org.apache.nifi.nar.NarUnpacker.unpackNars(NarUnpacker.java:90).  &lt;BR /&gt;   at org.apache.nifi.nar.NarUnpacker.unpackNars(NarUnpacker.java:84)&lt;BR /&gt;   at org.apache.nifi.nar.NarUnpacker.unpackNars(NarUnpacker.java:75)&lt;BR /&gt;   at org.apache.nifi.NiFi.&amp;lt;init&amp;gt;(NiFi.java:142)&lt;BR /&gt;   at org.apache.nifi.NiFi.&amp;lt;init&amp;gt;(NiFi.java:83)&lt;BR /&gt;   at org.apache.nifi.NiFi.main(NiFi.java:332)&lt;/PRE&gt;&lt;DIV&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;Test Case 5: Running Zip Command inside TransformOS-nar directory with *&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;&lt;U&gt;Passed!!&lt;/U&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/DIV&gt;&lt;PRE&gt;zip -r archive_name.zip *&lt;BR /&gt;cp archive_name.zip ../Downloads/nifi-2.0.0-M4/lib/archive_name.nar&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;--------------------------------------------&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Now you are probably wondering what the difference is between Test Case 1 and Test Case 5 is... To go in further detail, here's the output of each zip command -&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Zip command output for Test Case 1:&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;drewnicolette@MacBook-Pro-2:~/TransformOS-nar&lt;BR /&gt;$ zip -r archive_name.zip TransformOpenskyStates.py NAR-INF/ META-INF/&lt;BR /&gt;    adding: TransformOpenskyStates.py (deflated 60%)&lt;BR /&gt;    adding: NAR-INF/ (stored 0%)&lt;BR /&gt;    adding: NAR-INF/.DS_Store (deflated 96%)&lt;BR /&gt;    adding: NAR-INF/bundled-dependencies/ (stored 0%)&lt;BR /&gt;    adding: META-INF/ (stored 0%)&lt;BR /&gt;    adding: META-INF/MANIFEST.MF (deflated 13%)&lt;BR /&gt;    adding: META-INF/.DS_Store (deflated 97%)&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;Zip command output for Test Case 5:&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;drewnicolette@MacBook-Pro-2:~/TransformOS-nar&lt;BR /&gt;$ zip -r archive_name.zip *&lt;BR /&gt;    adding: META-INF/ (stored 0%)&lt;BR /&gt;    adding: META-INF/MANIFEST.MF (deflated 13%)&lt;BR /&gt;    adding: META-INF/.DS_Store (deflated 97%)&lt;BR /&gt;    adding: NAR-INF/ (stored 0%)&lt;BR /&gt;    adding: NAR-INF/.DS_Store (deflated 96%)&lt;BR /&gt;    adding: NAR-INF/bundled-dependencies/ (stored 0%)&lt;BR /&gt;    adding: TransformOpenskyStates.py (deflated 60%)&lt;/PRE&gt;&lt;P&gt;It seems like it's zipping up the same files and the byte count for each .zip file are the same! Please see screenshot below!&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="drewski7_2-1729101815692.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/42163i64C76B92CF02D884/image-size/medium?v=v2&amp;amp;px=400" role="button" title="drewski7_2-1729101815692.png" alt="drewski7_2-1729101815692.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Solution:&amp;nbsp;&lt;/STRONG&gt;Order matters when zipping up the file! If you look above in Test Case 1, when I ran the zip command, it added TransformOpenskyStates.py first, while in Test Case 5 it added META-INF/ first.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I believe NiFi code is expecting META-INF/ first??&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/35454"&gt;@MattWho&lt;/a&gt;&amp;nbsp;&lt;SPAN&gt;- Do you know anything about this?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Oct 2024 18:52:06 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/NiFi-2-0-0-Custom-Python-Processor-Uploading-Issue/m-p/395336#M248923</guid>
      <dc:creator>drewski7</dc:creator>
      <dc:date>2024-10-16T18:52:06Z</dc:date>
    </item>
  </channel>
</rss>

