So I'm trying to finally move my web2py apps over to Python 3.7 before 
Python 2.7 reaches EOL and, while for the most part they're working fine, I 
am finding that when there is a problem the web2py Error ticket is just 
about useless (doesn't tell you where the error actually occurs) because 
web2py seems to be throwing its own exception while trying to handle the 
actual exception resulting in tracebacks that look like this:

Traceback

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.

Traceback (most recent call last):
  File "C:\FMSC_py3\web2py\gluon\restricted.py", line 220, in restricted
    exec(ccode, environment)
pyodbc.DataError: ('22003', '[22003] [Microsoft][SQL Server Native Client 
11.0][SQL Server]Arithmetic overflow error converting expression to data type 
int. (8115) (SQLExecDirectW)')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\FMSC_py3\web2py\gluon\restricted.py", line 141, in __init__
    self.traceback = traceback.format_exc()
AttributeError: 'NoneType' object has no attribute 'strip'


I'm using Python 3.7.2 on Win7 with a freshly downloaded copy of the web2py 
source and can reproduce this very easily within the included Welcome App 
by adding this to the default.py controller

def causeError():
    deliberate_error= 1/0
    return dict(deliberate_error=deliberate_error)

Which results in the below ticket. Which, while it does say the correct 
"division by zero" error, doesn't contain anything else useful in the 
traceback to actually say where in the code the error happens.

Error ticket for "welcome"Ticket ID

127.0.0.1.2019-02-01.10-10-20.33b63e41-eac2-4737-a257-37232cf4fb72
<class 'ZeroDivisionError'> division by zeroVersion
web2py™ Version 2.17.2-stable+timestamp.2018.10.06.18.54.02Traceback

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.

Traceback (most recent call last):
  File "C:\FMSC_py3\web2py\gluon\restricted.py", line 220, in restricted
    except HTTP:
ZeroDivisionError: division by zero

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\FMSC_py3\web2py\gluon\restricted.py", line 141, in __init__
    self.traceback = traceback.format_exc()
AttributeError: 'NoneType' object has no attribute 'strip'

In file: C:\FMSC_py3\web2py\applications\welcome\controllers/default.py

1.

<code object <module> at 0x03F546A8, file 
"C:\FMSC_py3\web2py\applications\welcome\controllers/default.py", line 8>



This issue is making it very difficult to actually use web2py with Python 3 
because when you inevitably make coding mistakes you cannot easily find 
them unlike under Python 2 where the web2py ticket's traceback tells you 
exactly where the issue is.

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to