Notifications
Clear all

[Solved] How to create output file from script node?

1 Posts
1 Users
2 Likes
747 Views
0
Topic starter

Within NEO Plasma, I have a script node with output type as 'File'. How to create a file from script node and assign it to output port?

1 Answer
2
Topic starter

The python script below will create a output file and assign it to output port.A simple breakdown of the script is below:

  1. Create a file under directory '/temp' i.e. '/temp/filename'
  2. Open the file for write
  3. Write data to the file
  4. assign the file path to the output ports i.e. 'outputs['Output 1'] = output_file'
def executeNode(inputs):
  # File can be created only under directory '/temp'
  output_file = '/temp/OutputFile'
  with open(output_file, "w") as file_obj:
    out_file.write('This is a sample')
  outputs = {}
  outputs['Output 1'] = output_file
  return outputs

Note: File can be created under directory '/temp'