I broke something

88 views
Skip to first unread message

Константин Комков

unread,
Jun 18, 2019, 6:34:22 AM6/18/19
to web2py-users
I have that error and also if I want check all errors through "Manage" -> "Errors" I see error too. Web2py 2.18.5, python 3.7.3. That error repeats in other projects(

Ticket ID

213.87.138.43.2019-06-18.09-16-19.f72752c4-8811-4910-b67f-6dc0ef26f964

<class 'UnicodeDecodeError'> 'ascii' codec can't decode byte 0xd0 in position 0: ordinal not in range(128)

Версия

web2py™Version 2.18.5-stable+timestamp.2019.04.08.04.22.03
PythonPython 3.7.3: C:\Python\python.exe (prefix: C:\Python)

Traceback

1.
2.
3.
4.
5.
6.
7.
8.
9.
Traceback (most recent call last):
File ".\gluon\restricted.py", line 219, in restricted
exec(ccode, environment)
File "C:\inetpub\wwwroot\applications\webabit\models\db.py", line 12, in <module>
session.connect(request, response, db_app, masterapp=None)
File ".\gluon\globals.py", line 971, in connect
session_data = pickle.loads(row['session_data'])
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 0: ordinal not in range(128)

Error snapshot help

UnicodeDecodeError('ascii' codec can't decode byte 0xd0 in position 0: ordinal not in range(128))

inspect attributes

Frames

  • File C:\inetpub\wwwroot\gluon\restricted.py in restricted at line 219 код аргументы переменные

  • File C:\inetpub\wwwroot\applications\webabit\models\db.py in <module> at line 12 код аргументы переменные

  • File C:\inetpub\wwwroot\gluon\globals.py in connect at line 971 код аргументы переменные

    Function argument list

    (self=<Storage {}>, request=<Storage {'env': <Storage {'HTTP_CONNECTION': 'c...gi': <gluon.main.LazyWSGI object at 0x02B7EFD0>}>, response=<Storage {'status': 200, 'headers': {'X-Powered-..., modified_datetime, unique_key, session_data)>}>, db=<DAL uri="sqlite://storage.sqlite">, tablename='web2py_session', masterapp='webabit', migrate=True, separate=None, check_client=False, cookie_key=None, cookie_expires=None, compression_level=None)

    Code listing
    966.
    967.
    968.
    969.
    970.
    971.
    972.
    973.
    974.
    975.
                        row = table(record_id, unique_key=unique_key)
    # Make sure the session data exists in the database
    if row:
    # rows[0].update_record(locked=True)
    # Unpickle the data
    session_data = pickle.loads(row['session_data'])
    self.update(session_data)
    response.session_new = False
    else
    :
    record_id = None
    Variables
    session_dataundefined
    global pickle<module 'pickle' from 'C:\\Python\\lib\\pickle.py'>
    pickle.loads<built-in function loads>
    row<Row {'id': 594, 'locked': False, 'client_ip': '...ue_key':

Константин Комков

unread,
Jun 18, 2019, 8:11:14 AM6/18/19
to web2py-users
Also I see that error:

Ticket ID

10.250.10.160.2019-06-18.11-10-10.65f5c525-97e7-4cf4-985b-eea6fd89e420

Версия

web2py™Version 2.18.5-stable+timestamp.2019.04.08.04.22.03
PythonPython 3.7.3: C:\Python\python.exe (prefix: C:\Python)

Traceback

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
Traceback (most recent call last
):
File ".\gluon\main.py", line 444, in wsgibase
serve_controller(request, response, session)
File ".\gluon\main.py", line 179, in serve_controller
page = run_controller_in(request.controller, request.function, environment)
File ".\gluon\compileapp.py", line 657, in run_controller_in
ccode = getcfs(layer, filename, lambda: compile2(code, filename))
File ".\gluon\cfs.py", line 50, in getcfs
data = filter()
File ".\gluon\compileapp.py", line 657, in <lambda>
ccode = getcfs(layer, filename, lambda: compile2(code, filename))
File ".\gluon\restricted.py", line 205, in compile2
return compile(code, layer, 'exec')
File "C:\inetpub\wwwroot\applications\stud\controllers/appadmin.py", line 270
except Exception, e:
^
SyntaxError: invalid syntax

Error snapshot help

SyntaxError(invalid syntax (controllers/appadmin.py, line 270))

inspect attributes

Frames

  • File C:\inetpub\wwwroot\gluon\main.py in wsgibase at line 444 код аргументы переменные

  • File C:\inetpub\wwwroot\gluon\main.py in serve_controller at line 179 код аргументы переменные

  • File C:\inetpub\wwwroot\gluon\compileapp.py in run_controller_in at line 657 код аргументы переменные

  • File C:\inetpub\wwwroot\gluon\cfs.py in getcfs at line 50 код аргументы переменные

  • File C:\inetpub\wwwroot\gluon\compileapp.py in <lambda> at line 657 код аргументы переменные

  • File C:\inetpub\wwwroot\gluon\restricted.py in compile2 at line 205 код аргументы переменные

    Function argument list

    (code='# -*- coding: utf-8 -*-\n\n# #####################...n ul_main\n\nresponse._vars=response._caller(hooks)', layer=r'C:\inetpub\wwwroot\applications\stud\controllers/appadmin.py')

    Code listing
    200.
    201.
    202.
    203.
    204.
    205.
    206.
    207.
    208.
    209.
                output = ""
    return output


    def compile2(code, layer):
    return compile(code, layer, 'exec')


    def restricted(ccode, environment=None, layer='Unknown', scode=None):
    """
    Variables
    builtincompile<built-in function compile>
    code'# -*- coding: utf-8 -*-\n\n# #####################...n ul_main\n\nresponse._vars=response._caller(hooks)'
    layerr'C:\inetpub\wwwroot\applications\stud\controllers/appadmin.py'

Jim S

unread,
Jun 18, 2019, 4:19:40 PM6/18/19
to web2py-users
Isn't that an old except syntax that is not supported in Python 3?

I'm thinking it should be:

except Exception as e:

...but, I'm no expert in 2 to 3 changes.  Anyone else know more about this?

-Jim

Massimiliano

unread,
Jun 18, 2019, 4:37:34 PM6/18/19
to web...@googlegroups.com
The error seems to be in:
session_data = pickle.loads(row['session_data'])
try to delete session files or data

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/b5139753-1f20-4252-ba1b-078a5fac2095%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Massimiliano

Константин Комков

unread,
Jun 18, 2019, 4:47:31 PM6/18/19
to web2py-users
Leonel Câmara, told me delete all errors and session files when I change web2py version. As I think that can be useful in my situation. I deleted all errors in all apps and now don't see new errors. I will be wait and check apps errors tomorrow. Thank you, Jim S and Massimiliano.

Vlad

unread,
May 25, 2020, 4:29:20 AM5/25/20
to web2py-users
I am having the exact same problem, removing session data did not help.

2.20.4-stable+timestamp.2020.05.03.05.18.50
(Running on Rocket 1.2.6, Python 3.7.2)

I downloaded the latest web2py source, the app I am running was originally in python2.7, however.

Are there any alternatives other than going back to the old python version?
To unsubscribe from this group and stop receiving emails from it, send an email to web...@googlegroups.com.


--
Massimiliano

Lovedie JC

unread,
May 25, 2020, 11:03:52 AM5/25/20
to web...@googlegroups.com
I got several such errors in p3.
Changing to:
Except Exception as e:
Works for me. 

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/7c359d91-336c-4166-8178-08707cc5f016%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages