title: Why am I getting a NameError when trying to call my Javascript array in a template?
body: <p>Here is the view callable for my home page that defines jsdata:    </p>
  
  <pre><code>@view_config(route_name='home_page', renderer='templates/edit.pt')
  def home_page(request):
      if 'form.submitted' in request.params:
          name= request.params['name']
          input_file=request.POST['stl'].filename
          vertices, normals = [],[]
          for line in input_file:
              ....
  
          ordering=[]
  
          ...parsing data...
  
          data=[vertices,ordering]
          jsdata=json.dumps(data)
          renderer_dict = dict(name=name,data=jsdata)
          ...
          html_string = render('tutorial:templates/view.pt', renderer_dict, request=request)
          with open(filename,'w') as file:
                  file.write(html_string)
          return HTTPFound(location=request.static_url('tutorial:pages/%(pagename)s.html')% {'pagename':name}) 
  
      return {}    
  </code></pre>
  
  <p>I have imported json as well in that file (views.py). Here it is being rendered on the view.pt template. </p>
  
  <pre><code>&lt;script&gt;
  var data = ${structure:jsdata};
  &lt;/script&gt;
  </code></pre>
  
  <p>the NameError points to the jsdata part of that second line. Why is this happening? Doesn't name error mean that it is undefined? Why is it saying that jsdata is undefined? Should it be passed as a keyword into the render function?</p>
  
  <p>Also: I am aware that there may be errors below that jsdata definition. I have included that part in case it helps you see what I want to be doing with jsdata</p>