Pylons / pyramid

Pyramid - A Python web framework
https://trypyramid.com/
Other
3.97k stars 887 forks source link

tutorial/forms got ERROR:waitress:Exception while serving /favicon.ico #3703

Open LogiFarmer opened 2 years ago

LogiFarmer commented 2 years ago

Get Support

To get help or technical support, see Get Support.

Bug Report

Please search the issue tracker for similar issues before submitting a new issue.

Describe the bug Try to run tutorial/forms, got this exception.

To Reproduce C:\projects\quick_tutorial\forms>%VENV%\scripts\pserve development.ini --reload Starting monitor for PID 9444. Starting server in PID 14480. ERROR:waitress:Exception while serving /favicon.ico Traceback (most recent call last): File "c:\projects\quick_tutorial\env\lib\site-packages\pyramid\tweens.py", line 13, in _error_handler response = request.invoke_exception_view(exc_info) File "c:\projects\quick_tutorial\env\lib\site-packages\pyramid\view.py", line 786, in invoke_exception_view raise HTTPNotFound pyramid.httpexceptions.HTTPNotFound: The resource could not be found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "c:\projects\quick_tutorial\env\lib\site-packages\waitress\channel.py", line 426, in service task.service() File "c:\projects\quick_tutorial\env\lib\site-packages\waitress\task.py", line 168, in service self.execute() File "c:\projects\quick_tutorial\env\lib\site-packages\waitress\task.py", line 434, in execute app_iter = self.channel.server.application(environ, start_response) File "c:\projects\quick_tutorial\env\lib\site-packages\pyramid\router.py", line 270, in call response = self.execution_policy(environ, self) File "c:\projects\quick_tutorial\env\lib\site-packages\pyramid\router.py", line 276, in default_execution_policy return router.invoke_request(request) File "c:\projects\quick_tutorial\env\lib\site-packages\pyramid\router.py", line 245, in invoke_request response = handle_request(request) File "c:\projects\quick_tutorial\env\lib\site-packages\pyramid_debugtoolbar\toolbar.py", line 238, in toolbar_tween return handler(request) File "c:\projects\quick_tutorial\env\lib\site-packages\pyramid\tweens.py", line 43, in excview_tween response = _error_handler(request, exc) File "c:\projects\quick_tutorial\env\lib\site-packages\pyramid\tweens.py", line 17, in _error_handler reraise(*exc_info) File "c:\projects\quick_tutorial\env\lib\site-packages\pyramid\util.py", line 733, in reraise raise value File "c:\projects\quick_tutorial\env\lib\site-packages\pyramid\tweens.py", line 41, in excview_tween response = handler(request) File "c:\projects\quick_tutorial\env\lib\site-packages\pyramid\router.py", line 143, in handle_request response = _call_view( File "c:\projects\quick_tutorial\env\lib\site-packages\pyramid\view.py", line 674, in _call_view response = view_callable(context, request) File "c:\projects\quick_tutorial\env\lib\site-packages\pyramid\viewderivers.py", line 427, in rendered_view result = view(context, request) File "c:\projects\quick_tutorial\env\lib\site-packages\pyramid\viewderivers.py", line 113, in _class_requestonly_view response = getattr(inst, attr)() File "c:\projects\quick_tutorial\forms\tutorial\views.py", line 64, in wikipage_view page = pages[uid] KeyError: 'favicon.ico'

stevepiercy commented 2 years ago

This is expected and you can safely ignore this error. The app continues to run. There is no favicon.ico file included in the tutorial, so it cannot be found.

You can add a favicon along with an add_static_view to resolve the error message.

LogiFarmer commented 2 years ago

Yes, I fixed it just as you say. Could a favicon be added to the tutorials to avoid confusion? Thanks.

stevepiercy commented 2 years ago

Well, it could, but then you wouldn't have a puzzle to solve, would you? :wink:

Keep in mind this is a "Quick Tutorial", and is not designed to be complete or comprehensive. Each step focuses on a single given topic. In this step, forms are the focus. Static assets is in Step 13.

That said, this would be a good Extra Credit question in the tutorial documentation where it first occurs.