<p>I am trying to access the content(json data) of a file which is passed as input artifacts to a script template. It is failing with the following error <code>NameError: name 'inputs' is not defined. Did you mean: 'input'?</code></p>
<p>My artifacts are being stored in aws s3 bucket. I've also tried using environment variables instead of directly referring the artifacts directly in script template, but it is also not working.</p>
<p>Here is my workflow</p>
<pre><code>apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  generateName: output-artifact-s3-
spec:
  entrypoint: main
  templates:
    - name: main
      dag:
        tasks:
          - name: whalesay-script-template
            template: whalesay

          - name: retrieve-output-template
            dependencies: [whalesay-script-template]
            arguments:
              artifacts:
                - name: result
                  from: &quot;{{tasks.whalesay-script-template.outputs.artifacts.message}}&quot;
            template: retrieve-output


    - name: whalesay
      script:
        image: python
        command: [python]
        env:
          - name: OUTDATA
            value: |
              {
              &quot;lb_url&quot; : &quot;&lt;&gt;.us-east-1.elb.amazonaws.com&quot;,
              &quot;vpc_id&quot; : &quot;&lt;vpc-id&quot;,
              &quot;web_server_count&quot; : &quot;4&quot;
              }
        source: |
          import json
          import os
          OUTDATA = json.loads(os.environ[&quot;OUTDATA&quot;])
          with open('/tmp/templates_lst.txt', 'w') as outfile:
            outfile.write(str(json.dumps(OUTDATA)))
        volumeMounts:
          - name: out
            mountPath: /tmp
      volumes:
        - name: out
          emptyDir: { }
      outputs:
        artifacts:
          - name: message
            path: /tmp


    - name: retrieve-output
      inputs:
        artifacts:
          - name: result
            path: /tmp
      script:
        image: python
        command: [python]
        source: |
          import json
          result = {{inputs.artifacts.result}}
          with open(result, 'r') as outfile:
            lines = outfile.read()
            print(lines)
          print('Execution completed')
</code></pre>
<p>What's wrong in this workflow?</p>

<p>In the last template, replace <code>{{inputs.artifacts.result}}</code> with <code>”/tmp/templates_lst.txt”</code>.</p>
<p><code>inputs.artifacts.NAME</code> has no meaning in the <code>source</code> field, so Argo leaves it as-is. Python tries to interpret it as code, which is why you get an exception.</p>
<p>The proper way to communicate an input artifact to Python in Argo is to specify the artifact destination (which you’ve done) in the templates input definition. Then in Python, use files from that path the same way you would do in any Python app.</p>
