<class 'KeyError'> 255

350 views
Skip to first unread message

Andrea Fae'

unread,
Mar 29, 2020, 3:13:14 PM3/29/20
to web2py-users
I have this problem using web2py 2.18 with pyrhon 3.8 and mysql.
When I log in int the app it happens this error:

<class 'KeyError'> 255


I don't know id it's an error regarding mysql....

Versione

web2py™Version 2.19.1-stable+timestamp.2020.03.21.21.49.28
PythonPython 3.8.2: C:\Python38\python.exe (prefix: C:\Python38)

Traceback

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
Traceback (most recent call last):
File "C:\web2py\gluon\restricted.py", line 219, in restricted
exec(ccode, environment)
File "C:\web2py\applications\gaweb\controllers/default.py", line 1720, in <module>
File "C:\web2py\gluon\globals.py", line 422, in <lambda>
self._caller = lambda f: f()
File "C:\web2py\applications\gaweb\controllers/default.py", line 1701, in user
return dict(form=auth())
File "C:\web2py\gluon\tools.py", line 1801, in __call__
return getattr(self, args[0])()
File "C:\web2py\gluon\tools.py", line 2586, in login
user = table_user(**{username: entered_username})
File "C:\web2py\gluon\packages\dal\pydal\objects.py", line 718, in __call__
self._db(query)
File "C:\web2py\gluon\packages\dal\pydal\objects.py", line 2634, in select
return adapter.select(self.query, fields, attributes)
File "C:\web2py\gluon\packages\dal\pydal\adapters\base.py", line 878, in select
return self._select_aux(sql, fields, attributes, colnames)
File "C:\web2py\gluon\packages\dal\pydal\adapters\base.py", line 835, in _select_aux
rows = self._select_aux_execute(sql)
File "C:\web2py\gluon\packages\dal\pydal\adapters\base.py", line 829, in _select_aux_execute
self.execute(sql)
File "C:\web2py\gluon\packages\dal\pydal\adapters\__init__.py", line 65, in wrap
if not args[0].connection:
File "C:\web2py\gluon\packages\dal\pydal\connection.py", line 32, in connection
return self.get_connection()
File "C:\web2py\gluon\packages\dal\pydal\connection.py", line 65, in get_connection
connection = self.connector()
File "C:\web2py\gluon\packages\dal\pydal\adapters\mysql.py", line 61, in connector
conn = self.driver.connect(**self.driver_args)
File "C:\web2py\gluon\contrib\pymysql\__init__.py", line 90, in Connect
return Connection(*args, **kwargs)
File "C:\web2py\gluon\contrib\pymysql\connections.py", line 688, in __init__
self.connect()
File "C:\web2py\gluon\contrib\pymysql\connections.py", line 905, in connect
self._get_server_information()
File "C:\web2py\gluon\contrib\pymysql\connections.py", line 1231, in _get_server_information
self.server_charset = charset_by_id(lang).name
File "C:\web2py\gluon\contrib\pymysql\charset.py", line 38, in by_id
return self._by_id[id]
KeyError: 255

Dave S

unread,
Mar 29, 2020, 6:16:57 PM3/29/20
to web2py-users


On Sunday, March 29, 2020 at 8:13:14 AM UTC-7, Andrea Fae' wrote:
I have this problem using web2py 2.18 with pyrhon 3.8 and mysql.
When I log in int the app it happens this error:

For 3.8, you may need to update to 2.19.1, just released.

/dps

Andrea Fae'

unread,
Mar 29, 2020, 6:21:48 PM3/29/20
to web2py-users
I'm sorry but is still

Versione

web2py™Version 2.19.1-stable+timestamp.2020.03.21.21.49.28
PythonPython 3.8.2: C:\Python38\python.exe (prefix: C:\Python38)


Geo

unread,
May 26, 2020, 7:41:45 AM5/26/20
to web...@googlegroups.com
I use python 3.7 but I had the same issue, to solve it I kind of cheated by adding MySQL default charset 255

in gluon\contrib\pymsysql\charset.py I have added this at line 260 (at the end of the list of charsets)

_charsets.add(Charset(255, 'utf8mb4', 'utf8mb4_unicode_ci', ''))

then I deleted __pycache__/charset.cpython-37.pyc and restarted web2py

Ivan Luis

unread,
Jul 20, 2020, 5:24:15 AM7/20/20
to web2py-users
Where can i found pycache ? 

Geo

unread,
Oct 22, 2020, 12:54:35 PM10/22/20
to web2py-users
Hi Luis
sorry for the very late reply. Indeed I tried the same fix with web2py for Windows and the pycache folder is not present anywhere.
On the other hand the source version that I always used before produces it.

lcham...@gmail.com

unread,
Nov 4, 2020, 10:45:18 AM11/4/20
to web2py-users
Did you find  a solution ?
thanks

Reply all
Reply to author
Forward
0 new messages