Traceback (most recent call last):
File "R:\Website Extranet\Fuentes\web2py\gluon\main.py", line 329, in wsgibase
response.stream(static_file, request=request)
File "R:\Website Extranet\Fuentes\web2py\gluon\globals.py", line 617, in stream
status=self.status)
File "R:\Website Extranet\Fuentes\web2py\gluon\streamer.py", line 66, in stream_file_or_304_or_206
if e[0] == errno.EISDIR:
TypeError: 'FileNotFoundError' object is not subscriptable
except IOError as e:
if e[0] == errno.EISDIR:
raise HTTP(403, error_message, web2py_error='file is a directory')
elif e[0] == errno.EACCES:
raise HTTP(403, error_message, web2py_error='inaccessible file')
else:
raise HTTP(404, error_message, web2py_error='invalid file')
It seems only base/streamer.py and contrib/gateways/fcgi.py handle exceptions in this way.
With Python 3 there are definitely issues with the error traces. Sometimes is difficult to find what is failing.
Greetings.
Is anyone running into this issue? It's happening both in Windows and Linux.
Should I postpone migrating to python3?
On Wednesday, April 18, 2018 at 4:04:57 PM UTC-5, Antonio Salazar wrote:
The bug is very easy to reproduce:
- Clone the repository from GitHub
- Run python3 web2py.py
It seems only base/streamer.py and contrib/gateways/fcgi.py handle exceptions in this way.
On Wednesday, April 18, 2018 at 12:00:43 PM UTC-5, Antonio Salazar wrote:Now that web2py supports python 3, I just went on and migrated my website. All works fine, except for a crash which I'm not sure how to handle.
I get this when the browser looks for /favicon.ico (a non-existent file because it's in /images/favicon.ico)
Traceback (most recent call last):
File "R:\Website Extranet\Fuentes\web2py\gluon\main.py", line 329, in wsgibase
response.stream(static_file, request=request)
File "R:\Website Extranet\Fuentes\web2py\gluon\globals.py", line 617, in stream
status=self.status)
File "R:\Website Extranet\Fuentes\web2py\gluon\streamer.py", line 66, in stream_file_or_304_or_206
if e[0] == errno.EISDIR:
TypeError: 'FileNotFoundError' object is not subscriptable
The problem is the handling of exceptions in base/streamer.py
except IOError as e:
if e[0] == errno.EISDIR:
raise HTTP(403, error_message, web2py_error='file is a directory')
elif e[0] == errno.EACCES:
raise HTTP(403, error_message, web2py_error='inaccessible file')
else:
raise HTTP(404, error_message, web2py_error='invalid file')
e[0] crashes because e is not indexable, it expects e.errno instead.
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.