Jim, I don't think that's possible because I don't think the user-defined properties are guaranteed to be in a particular order (insertion order in the processor config dialog, e.g.), but someone please correct me if I'm wrong. If true, then we wouldn't be able to have the user-defined properties set deterministically as "positional" arguments in an array.
You might be able to check to see if sys.argvs is defined [1] or None or empty, and if so, then try the user-defined properties as variables using the same technique. You wouldn't be able to support a "usage()" type of thing (where in a command-line script you print the usage if the arguments are not valid/complete), but you should be able to determine whether the script is being run from the command-line Python or from ExecuteScript Jython. Regards, Matt [1] https://stackoverflow.com/questions/1592565/determine-if-variable-is-defined-in-python On Sun, Feb 18, 2018 at 10:25 AM, James McMahon <jsmcmah...@gmail.com> wrote: > Checking back in. Can we reference the user-defined custom config parms > passed in from ExecuteScript as sys.argvs in the python script being > executed by ExecuteScript? > > On Fri, Feb 16, 2018 at 1:14 PM, James McMahon <jsmcmah...@gmail.com> wrote: >> >> Good afternoon. I have a python script I would like to run from >> ExecuteScript. Since my script can run from either a command line in debug >> mode or from the ES processor, I'd like to set up initial logic to determine >> which command line parms i have, and direct actions in the script >> accordingly. >> >> At the command line I'll execute like this: myScript.py [configFile_nifi] >> [loggingOutput as either of NIFI | SCRIPT] - two arguments. >> >> From Matt B's helpful post here... >> >> https://community.hortonworks.com/articles/77739/executescript-cookbook-part-3.html >> ...I know that I can feed the script these arguments from ExecuteScript by >> creating two new properties within ExecuteScript and setting their values. >> In the script I can read those into the script like this: >> configFile = configFile_nifi.getValue() >> targetOutput = loggingOutput.getValue() >> >> But i need to read these arguments in one way if they are from the command >> line, and using the above syntax if they are from the ExecuteScript call of >> the script. If set by the NiFi ES processor, can i refer to these parms as >> len(sys.argv), sys.argv[1], and sys.argv[2]? >> >> If not, how can I direct the setting of my script variables based on >> whether the arguments come from the command line or from the NiFi processor >> configuration? >> >> Jim > >