I managed to get a proper traceback with python 3 using:
try:
produce_error(2)
except:
etype, evalue, tb = sys.exc_info()
tbe = traceback.TracebackException( etype, evalue, tb )
print( ''.join(tbe.format()) )
I hope someone can look into how to properly log web2py tickets. Thank you!
On Wednesday, May 2, 2018 at 9:19:38 AM UTC+8, lyn2py wrote:
>
> Now I have an error like this one:
>
> RecursionError: maximum recursion depth exceeded while calling a Python object
>
>
> ...and I have no idea how to debug it, since I'm not using any recursion
> in my code. I suspect it's an issue with the module or modules (not written
> by me) I'm using, but I can't troubleshoot it or ask anyone about it
> without a proper traceback. Admittedly I'm no traceback expert, as a
> quick-fix, I tried to print the traceback results to console but nothing
> came up :(
>
>
> On Wednesday, May 2, 2018 at 2:31:43 AM UTC+8, lyn2py wrote:
>>
>> Hello,
>>
>> I've started using python3 with web2py and it has saved me a lot of
>> encoding headaches.
>>
>> However, the traceback Tickets in web2py are not as comprehensive as
>> those in python2 with web2py. They look like:
>>
>> <class 'AttributeError'> 'dict' object has no attribute 'content'Version
>> web2py™ Version 2.16.1-stable+timestamp.2018.03.08.10.23.01Traceback
>>
>> 1.
>> 2.
>> 3.
>> 4.
>> 5.
>> 6.
>> 7.
>> 8.
>> 9.
>> 10.
>> 11.
>> 12.
>>
>> Traceback (most recent call last):
>> File "/Users/web2py/gluon/restricted.py", line 219, in restricted
>> exec(ccode, environment)
>> AttributeError: 'dict' object has no attribute 'content'
>>
>> During handling of the above exception, another exception occurred:
>>
>> Traceback (most recent call last):
>> File "/Users/web2py/gluon/restricted.py", line 141, in __init__
>> self.traceback = traceback.format_exc()
>> AttributeError: 'NoneType' object has no attribute 'strip'
>>
>> In file: /Users/web2py/source/applications/app/controllers/app.py
>>
>> 1.
>>
>> <code object <module> at 0x110fe34b0, file
>> "/Users/web2py/applications/app/controllers/app.py", line 1>
>>
>>
>>
>> Now, the above error is easy to troubleshoot, because it is quite obvious
>> (can just do a search on the specific file, but I've encountered some like:
>>
>> UnicodeEncodeError: 'ascii' codec can't encode character '\u2019' in
>> position 11: ordinal not in range(128)
>>
>> (yes, I still encounter an encoding issue in python3! haha.)
>>
>> ...and without the specific line in the file, it gets difficult to debug
>> the code. It took 30 mins to find the problematic line and turns out it
>> originated from another file (module file). And purely through guesswork I
>> hit the jackpot after 40mins.
>>
>> In any case, all the tracebacks for Python 3 look like:
>>
>> Traceback (most recent call last):
>> File "/Users/web2py/gluon/restricted.py", line 219, in restricted
>> exec(ccode, environment)
>> <error listed here>
>>
>>
>> I hope the traceback Ticket can be more helpful for troubleshooting.
>> Would appreciate if a fix can be soon...
>>
>> Thank you!
>>
>>
>>
>>
>>
>>
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.