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 Build a Social Network with Flask Takin' Names Macros

The program does not run locally

I get TypeError: argument of type '_RequestGlobals' is not iterable

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1701, in __call__
    return self.wsgi_app(environ, start_response)
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1689, in wsgi_app
    response = self.make_response(self.handle_exception(e))
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1687, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1360, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1358, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1344, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/vagrant/Treehouse/social/app.py", line 43, in register
    form = forms.RegisterForm()
  File "/home/vagrant/.local/lib/python2.7/site-packages/wtforms/form.py", line 212, in __call__
    return type.__call__(cls, *args, **kwargs)
  File "/home/vagrant/.local/lib/python2.7/site-packages/flask_wtf/form.py", line 158, in __init__
    super(Form, self).__init__(*args, **kwargs)
  File "/home/vagrant/.local/lib/python2.7/site-packages/flask_wtf/form.py", line 88, in __init__
    super(FlaskForm, self).__init__(formdata=formdata, **kwargs)
  File "/home/vagrant/.local/lib/python2.7/site-packages/wtforms/form.py", line 278, in __init__
    self.process(formdata, obj, data=data, **kwargs)
  File "/home/vagrant/.local/lib/python2.7/site-packages/wtforms/form.py", line 132, in process
    field.process(formdata)
  File "/home/vagrant/.local/lib/python2.7/site-packages/wtforms/csrf/core.py", line 43, in process
    self.current_token = self.csrf_impl.generate_csrf_token(self)
  File "/home/vagrant/.local/lib/python2.7/site-packages/flask_wtf/csrf.py", line 134, in generate_csrf_token
    token_key=self.meta.csrf_field_name
  File "/home/vagrant/.local/lib/python2.7/site-packages/flask_wtf/csrf.py", line 42, in generate_csrf
    if field_name not in g:
  File "/usr/local/lib/python2.7/dist-packages/werkzeug/local.py", line 365, in <lambda>
    __contains__ = lambda x, i: i in x._get_current_object()
TypeError: argument of type '_RequestGlobals' is not iterable

MOD: Added formatting so it's easier to read the output - you can use three backticks ``` before and after the block of code to make it show up like this. (See the Markdown Cheatsheet linked just below the textbox for your question.)

1 Answer

You probably want to use a recent python 3, rather than python 2.7.