Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Build a Social Network with Flask Tacocat Challenge The Challenge

Anders Axelsen
Anders Axelsen
3,470 Points

Two errors remain to be corrected. How do I interpret the unit test and solve the problem?

Hi there!

So far, it has been relatively simple for me to interpret the errors in the unit test. There are two errors remaining, and I can't seem to fix them.

Here is a snapshot of my workspace.

error 1

treehouse:~/workspace$ python app_tests.py                                                                                                                                         
.......EE..                                                                                                                                                                        
======================================================================                                                                                                             
ERROR: test_logged_in_menu (__main__.UserViewsTestCase)                                                                                                                            
----------------------------------------------------------------------                                                                                                             
Traceback (most recent call last):                                                                                                                                                 
  File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/peewee.py", line 2780, in execute_sql                                                                          
    cursor.execute(sql, params or ())                                                                                                                                              
sqlite3.OperationalError: no such column: t1.extras                                                                                                                                

During handling of the above exception, another exception occurred:                                                                                                                

Traceback (most recent call last):                                                                                                                                                 
  File "app_tests.py", line 120, in test_logged_in_menu                                                                                                                            
    rv = self.app.get('/')                                                                                                                                                         
  File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/werkzeug/test.py", line 791, in get                                                                            
    return self.open(*args, **kw)                                                                                                                                                  
  File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/flask/testing.py", line 108, in open                                                                           
    follow_redirects=follow_redirects)                                                                                                                                             
  File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/werkzeug/test.py", line 764, in open                                                                           
    response = self.run_wsgi_app(environ, buffered=buffered)                                                                                                                       
  File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/werkzeug/test.py", line 677, in run_wsgi_app                                                                   
    rv = run_wsgi_app(self.application, environ, buffered=buffered)                                                                                                                
  File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/werkzeug/test.py", line 884, in run_wsgi_app                                                                   
    app_rv = app(environ, start_response)                                                                                                                                          
  File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/flask/app.py", line 1836, in __call__                                                                          
    return self.wsgi_app(environ, start_response)                                                                                                                                  
  File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/flask/app.py", line 1820, in wsgi_app                                                                          
    response = self.make_response(self.handle_exception(e))                                                                                                                        
  File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/flask/app.py", line 1403, in handle_exception                                                                  
    reraise(exc_type, exc_value, tb)                                                                                                                                               
  File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/flask/_compat.py", line 33, in reraise                                                                         
    raise value                    
File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/flask/app.py", line 1817, in wsgi_app                                                                          
    response = self.full_dispatch_request()                                                                                                                                        
  File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/flask/app.py", line 1477, in full_dispatch_requ                                                                
    rv = self.handle_user_exception(e)                                                                                                                                             
  File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/flask/app.py", line 1381, in handle_user_except                                                                
    reraise(exc_type, exc_value, tb)                                                                                                                                               
  File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/flask/_compat.py", line 33, in reraise                                                                         
    raise value                                                                                                                                                                    
  File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/flask/app.py", line 1475, in full_dispatch_requ                                                                
    rv = self.dispatch_request()                                                                                                                                                   
  File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/flask/app.py", line 1461, in dispatch_request                                                                  
    return self.view_functions[rule.endpoint](**req.view_args)                                                                                                                     
  File "/home/treehouse/workspace/tacocat.py", line 103, in index                                                                                                                  
    return render_template('index.html', tacos=tacos)                                                                                                                              
  File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/flask/templating.py", line 128, in render_templ                                                                
    context, ctx.app)                                                                                                                                                              
  File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/flask/templating.py", line 110, in _render                                                                     
    rv = template.render(context)                                                                                                                                                  
  File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/jinja2/environment.py", line 969, in render                                                                    
    return self.environment.handle_exception(exc_info, True)                                                                                                                       
  File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/jinja2/environment.py", line 742, in handle_exc                                                                
    reraise(exc_type, exc_value, tb)                                                                                                                                               
  File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/jinja2/_compat.py", line 36, in reraise                                                                        
    raise value.with_traceback(tb)                                                                                                                                                 
  File "/home/treehouse/workspace/templates/index.html", line 1, in <module>                                                                                                       
    {% extends 'layout.html' %}                                                                                                                                                    
  File "/home/treehouse/workspace/templates/layout.html", line 35, in <module>                                                                                                     
    {% block content %}{% endblock %}                                                                                                                                              
  File "/home/treehouse/workspace/templates/index.html", line 5, in <module>                                                                                                       
    {% if tacos.count() %}                                                                                                                                                         
  File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/peewee.py", line 2412, in count                                                                                
    return self.wrapped_count(clear_limit=clear_limit)                                                                                                                             
  File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/peewee.py", line 2425, in wrapped_count                                                                        
    return rq.scalar() or 0      
File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/peewee.py", line 2181, in scalar                                                                               
    row = self._execute().fetchone()                                                                                                                                               
  File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/peewee.py", line 2172, in _execute                                                                             
    return self.database.execute_sql(sql, params, self.require_commit)                                                                                                             
  File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/peewee.py", line 2788, in execute_sql                                                                          
    self.commit()                                                                                                                                                                  
  File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/peewee.py", line 2657, in __exit__                                                                             
    reraise(new_type, new_type(*exc_value.args), traceback)                                                                                                                        
  File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/peewee.py", line 115, in reraise                                                                               
    raise value.with_traceback(tb)                                                                                                                                                 
  File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/peewee.py", line 2780, in execute_sql                                                                          
    cursor.execute(sql, params or ())                                                                                                                                              
peewee.OperationalError: no such column: t1.extras

error 2

======================================================================                                                                                                             
ERROR: test_logged_out_menu (__main__.UserViewsTestCase)                                                                                                                           
----------------------------------------------------------------------                                                                                                             
Traceback (most recent call last):                                                                                                                                                 
  File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/peewee.py", line 2780, in execute_sql                                                                          
    cursor.execute(sql, params or ())                                                                                                                                              
sqlite3.OperationalError: no such column: t1.extras                                                                                                                                

During handling of the above exception, another exception occurred:                                                                                                                

Traceback (most recent call last):                                                                                                                                                 
  File "app_tests.py", line 112, in test_logged_out_menu                                                                                                                           
    rv = self.app.get('/')                                                                                                                                                         
  File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/werkzeug/test.py", line 791, in get                                                                            
    return self.open(*args, **kw)                                                                                                                                                  
  File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/flask/testing.py", line 108, in open                                                                           
    follow_redirects=follow_redirects)                                                                                                                                             
  File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/werkzeug/test.py", line 764, in open                                                                           
    response = self.run_wsgi_app(environ, buffered=buffered)                                                                                                                       
  File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/werkzeug/test.py", line 677, in run_wsgi_app                                                                   
    rv = run_wsgi_app(self.application, environ, buffered=buffered)                                                                                                                
  File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/werkzeug/test.py", line 884, in run_wsgi_app                                                                   
    app_rv = app(environ, start_response)                                    
File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/flask/app.py", line 1820, in wsgi_app                                                                          
    response = self.make_response(self.handle_exception(e))                                                                                                                        
  File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/flask/app.py", line 1403, in handle_exception                                                                  
    reraise(exc_type, exc_value, tb)                                                                                                                                               
  File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/flask/_compat.py", line 33, in reraise                                                                         
    raise value                                                                                                                                                                    
  File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/flask/app.py", line 1817, in wsgi_app                                                                          
    response = self.full_dispatch_request()                                                                                                                                        
  File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/flask/app.py", line 1477, in full_dispatch_requ                                                                
    rv = self.handle_user_exception(e)                                                                                                                                             
  File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/flask/app.py", line 1381, in handle_user_except                                                                
    reraise(exc_type, exc_value, tb)                                                                                                                                               
  File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/flask/_compat.py", line 33, in reraise                                                                         
    raise value                                                                                                                                                                    
  File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/flask/app.py", line 1475, in full_dispatch_requ                                                                
    rv = self.dispatch_request()                                                                                                                                                   
  File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/flask/app.py", line 1461, in dispatch_request                                                                  
    return self.view_functions[rule.endpoint](**req.view_args)                                                                                                                     
  File "/home/treehouse/workspace/tacocat.py", line 103, in index                                                                                                                  
    return render_template('index.html', tacos=tacos)                                                                                                                              
  File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/flask/templating.py", line 128, in render_templ                                                                
    context, ctx.app)                                                                                                                                                              
  File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/flask/templating.py", line 110, in _render                                                                     
    rv = template.render(context)                                                                                                                                                  
  File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/jinja2/environment.py", line 969, in render                                                                    
    return self.environment.handle_exception(exc_info, True)                                                                                                                       
  File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/jinja2/environment.py", line 742, in handle_exc                                                                
    reraise(exc_type, exc_value, tb)                                                                                                                                               
  File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/jinja2/_compat.py", line 36, in reraise                                                                        
    raise value.with_traceback(tb)                                                                                                                                                 
  File "/home/treehouse/workspace/templates/index.html", line 1, in <module>                                                                                                       
    {% extends 'layout.html' %}                                                                                                                                                    
  File "/home/treehouse/workspace/templates/layout.html", line 35, in <module>                                                                                                     
    {% block content %}{% endblock %}                                                                                                                                              
  File "/home/treehouse/workspace/templates/index.html", line 5, in <module>                                                                                                       
    {% if tacos.count() %}                                                     
                                File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/peewee.py", line 2412, in count                                                                                
    return self.wrapped_count(clear_limit=clear_limit)                                                                                                                             
  File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/peewee.py", line 2425, in wrapped_count                                                                        
    return rq.scalar() or 0                                                                                                                                                        
  File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/peewee.py", line 2181, in scalar                                                                               
    row = self._execute().fetchone()                                                                                                                                               
  File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/peewee.py", line 2172, in _execute                                                                             
    return self.database.execute_sql(sql, params, self.require_commit)                                                                                                             
  File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/peewee.py", line 2788, in execute_sql                                                                          
    self.commit()                                                                                                                                                                  
  File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/peewee.py", line 2657, in __exit__                                                                             
    reraise(new_type, new_type(*exc_value.args), traceback)                                                                                                                        
  File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/peewee.py", line 115, in reraise                                                                               
    raise value.with_traceback(tb)                                                                                                                                                 
  File "/usr/local/pyenv/versions/3.5.0/lib/python3.5/site-packages/peewee.py", line 2780, in execute_sql                                                                          
    cursor.execute(sql, params or ())                                                                                                                                              
peewee.OperationalError: no such column: t1.extras                                                                                                                                 

----------------------------------------------------------------------                                                                                                             
Ran 11 tests in 14.830s                                                                                                                                                            

FAILED (errors=2)                                                                   

1 Answer

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 67,989 Points

It looks like both errors have the same cause: peewee.OperationalError: no such column: t1.extras

This means the "extras" column is not in the database. Do you need to recreate the database since the latest change to the models?

Try removing the tacocat.db and rerunning.

Post back if you need more help. Good luck!!

Anders Axelsen
Anders Axelsen
3,470 Points

Hi Chris!

Thank you very much - spot on!

A new problem has arised. Nothing happens, when I click "Add new taco".

Anders Axelsen
Anders Axelsen
3,470 Points

Alright, I might make another post for that. :-)

course videos may solve this, though..