Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python

competent- fellow
competent- fellow
5,846 Points

"name 'render' is not defined"

I was able to import "utils". However, "render" still did not work.

for label, value in balances.items(): render("The label {} has a value of {}".format(label,value)) --> NameError: name 'render' is not defined

I could not find any documentation for utils' render function online.

Instead, I just used print() and that worked just fine. Perhaps this is a version issue?

3 Answers

Hi Craig, did you import render with from django.shortcuts import render?

competent- fellow
competent- fellow
5,846 Points

Hello Mat. No. I did so with either:

  • from utils import render (which returns an error) Or:
  • import utils (error only when I call render) I installed utils with Anaconda.

Right on. Use the import I mentioned, and you should be good to go!

competent- fellow
competent- fellow
5,846 Points

Hello Matt. Thanks for your advice. I am not sure django's render does the same thing. I get this error message:

TypeError: render() missing 1 required positional argument: 'template_name'

Apologies, I may have misunderstood what was happening. Could you link this to the challenge or video you are working with?