Ex52. Change room just works a few times

Hello all my friends.

I have started to got the basic structure together.
show_room.html shows the name and description and the form works. Partly

Most of the time.I use Firefox
There I can change rooms a few times. Then it stop changing.
Seems that when I choose a room that already had been visited it stop working.

In the terminal I got this message:

127.0.0.1 - - [16/Jun/2019 20:55:58] “POST /game HTTP/1.1” 302 -
127.0.0.1 - - [16/Jun/2019 20:55:58] “GET /game HTTP/1.1” 200 -

However I tried to use Chromium today. Then I got this in the terminal:

TypeError: The view function did not return a valid response. The function either returned None or ended without a return statement.
127.0.0.1 - - [16/Jun/2019 20:40:08] “GET /game?debugger=yes&cmd=resource&f=style.css HTTP/1.1” 200 -
127.0.0.1 - - [16/Jun/2019 20:40:08] “GET /game?debugger=yes&cmd=resource&f=debugger.js HTTP/1.1” 200 -
127.0.0.1 - - [16/Jun/2019 20:40:08] “GET /game?debugger=yes&cmd=resource&f=jquery.js HTTP/1.1” 200 -
127.0.0.1 - - [16/Jun/2019 20:40:08] “GET /game?debugger=yes&cmd=resource&f=console.png HTTP/1.1” 200 -
127.0.0.1 - - [16/Jun/2019 20:40:08] “GET /game?debugger=yes&cmd=resource&f=console.png HTTP/1.1” 200 -

And this in web browser:

# TypeError

TypeError: The view function did not return a valid response. The function either returned None or ended without a return statement.

## Traceback  *(most recent call last)*

* #### File "/home/ulf/Documents/python/LPTHW/projects/python3_school/lessons/ex52/venv/lib/python3.6/site-packages/flask/app.py", line  *2328* , in  `__call__`

return self.wsgi_app(environ, start_response)

* #### File "/home/ulf/Documents/python/LPTHW/projects/python3_school/lessons/ex52/venv/lib/python3.6/site-packages/flask/app.py", line  *2314* , in  `wsgi_app`

response = self.handle_exception(e)

* #### File "/home/ulf/Documents/python/LPTHW/projects/python3_school/lessons/ex52/venv/lib/python3.6/site-packages/flask/app.py", line  *1760* , in  `handle_exception`

reraise(exc_type, exc_value, tb)

* #### File "/home/ulf/Documents/python/LPTHW/projects/python3_school/lessons/ex52/venv/lib/python3.6/site-packages/flask/_compat.py", line  *36* , in  `reraise`

raise value

* #### File "/home/ulf/Documents/python/LPTHW/projects/python3_school/lessons/ex52/venv/lib/python3.6/site-packages/flask/app.py", line  *2311* , in  `wsgi_app`

response = self.full_dispatch_request()

* #### File "/home/ulf/Documents/python/LPTHW/projects/python3_school/lessons/ex52/venv/lib/python3.6/site-packages/flask/app.py", line  *1835* , in  `full_dispatch_request`

return self.finalize_request(rv)

* #### File "/home/ulf/Documents/python/LPTHW/projects/python3_school/lessons/ex52/venv/lib/python3.6/site-packages/flask/app.py", line  *1850* , in  `finalize_request`

response = self.make_response(rv)

* #### File "/home/ulf/Documents/python/LPTHW/projects/python3_school/lessons/ex52/venv/lib/python3.6/site-packages/flask/app.py", line  *1976* , in  `make_response`

'The view function did not return a valid response. The'

> TypeError: The view function did not return a valid response. The function either returned None or ended without a return statement.

The debugger caught an exception in your WSGI application. You can now look at the traceback which led to the error.

To switch between the interactive traceback and the plaintext one, you can click on the "Traceback" headline. From the text traceback you can also create a paste of it. For code execution mouse-over the frame you want to debug and click on the console icon on the right side.

You can execute arbitrary Python code in the stack frames and there are some extra helpers available for introspection:

* `dump()`  shows all variables in the frame
* `dump(obj)`  dumps all that's known about the object

Brought to you by  **DON'T PANIC** , your friendly Werkzeug powered traceback interpreter.

If the solution is in front of me I just cannot see it right now.
Perhaps when I have posted this.
I need some distance for a while to start to see something.

But some hints where to look is also welcome.
:grinning:

Disregard this post
It actually works. I was just too tired to realize it. Perhaps a little bit narrow-minded it was a problem.
It was just me not really understood what was going on.
Now I do (I think).

Lesson learned:

  • Google about the problem for solutions,
  • Try some of what you find for a while,
  • When the brain start to get foggy, write about it.
  • Get away for a while,
  • Come back later,

I still don’t know what was not working yesterday but works today.
Perhaps I find out later.
But now I am on the track again.

2 Likes