I have a python script that reads a set of values that we want to expose out of PythonCaller as a list; however, after several attempts, we are having issues outputting the list out of the Transformer. Running the script works outside of workbench, but having issues incorporating the script with FME. Debugging the script and writing to the log, we know the code is calculating the values for the list consisting a several attributes. And, the thinking is we are not formatting the list correctly or defining it. I have attached a simple workbench that contains a slimmed down script that we are trying to utilize to determine how to output a list at all. Any help in this regard is much appreciated.
Â
Here is a part of the slimmed down script listing the nested loop we want to use and the List name we want to output:
Â
  def input(self,feature):
    Â
    npts = 3
    Â
    # do a bunch of stuff with other input attributes to populate D
Â
    C = /'X','Y']
    D = {'X':/2308759.15, 2308759.36, 2308759.60], 'Y': .10917108.40, 10917109.28, 10917110.13]}
      Â
    for i in C: # pass data to FME structured list called Survey{}
      for j in range(npts):
        d = str(D i]fj])
        feature.setAttribute('Survey{{{}}}.{}'.format(j,i),d)
        # print log to see if loop and format works
        msg = 'Survey{{{}}}.{}  {}'.format(j,i,d)
        fmeobjects.FMELogFile().logMessageString(msg)
Â
    self.pyoutput(feature)
Â
  def close(self):
Â
Â