psycopg2 error

40 views
Skip to first unread message

Maurice Waka

unread,
Feb 5, 2020, 9:44:44 AM2/5/20
to web2py-users
I recently installed python 3.6.9 and reinstalled web2py. Previously everything was working well. Now I have this error when trying to log in:

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.
Traceback (most recent call last):
File "/home/maurice/web2py/gluon/restricted.py", line 219, in restricted
exec(ccode, environment)
File "/home/maurice/web2py/applications/rivelar/models/db2.py", line 12, in <module>
db = DAL( "postgres://mauricewaka:b3th32dau2a##@localhost:5432/riveldb")#, migrate=False)
File "/home/maurice/web2py/gluon/packages/dal/pydal/base.py", line 171, in __call__
obj = super(MetaDAL, cls).__call__(*args, **kwargs)
File "/home/maurice/web2py/gluon/packages/dal/pydal/base.py", line 477, in __init__
"Failure to connect, tried %d times:\n%s" % (attempts, tb)
RuntimeError: Failure to connect, tried 5 times:
Traceback (most recent call last):
File "/home/maurice/web2py/gluon/packages/dal/pydal/base.py", line 457, in __init__
self._adapter = adapter(**kwargs)
File "/home/maurice/web2py/gluon/packages/dal/pydal/adapters/postgres.py", line 27, in __call__
return AdapterMeta.__call__(cls, *args, **kwargs)
File "/home/maurice/web2py/gluon/packages/dal/pydal/adapters/__init__.py", line 39, in __call__
obj = super(AdapterMeta, cls).__call__(*args, **kwargs)
File "/home/maurice/web2py/gluon/packages/dal/pydal/adapters/postgres.py", line 54, in __init__
driver_args, adapter_args, do_connect, after_connection)
File "/home/maurice/web2py/gluon/packages/dal/pydal/adapters/base.py", line 369, in __init__
super(SQLAdapter, self).__init__(*args, **kwargs)
File "/home/maurice/web2py/gluon/packages/dal/pydal/adapters/base.py", line 51, in __init__
self._initialize_(do_connect)
File "/home/maurice/web2py/gluon/packages/dal/pydal/adapters/postgres.py", line 95, in _initialize_
self.driver.__version__)
AttributeError: module 'gluon.contrib.psycopg2' has no attribute '__version__'

Maurice Waka

unread,
Feb 5, 2020, 9:55:47 AM2/5/20
to web2py-users
After reinstalling web2py (latest version) this is the new error:

29.
30.
31.
32.
33.
Traceback (most recent call last
):
File "/home/maurice/web2py1/gluon/authapi.py", line 590, in has_membership
group_id = int(group_id)
ValueError: invalid literal for int() with base 10: 'admin'

During handling of the above exception, another exception occurred:

Traceback (most recent call last
):
File "/home/maurice/web2py1/gluon/restricted.py", line 219, in restricted
exec(ccode, environment)
File "/home/maurice/web2py1/applications/rivelar/models/menu.py", line 32, in <module>
if auth.has_membership('admin'):#if auth.has_membership('Expert'):
File "/home/maurice/web2py1/gluon/authapi.py", line 592, in has_membership
group_id = self.id_group(group_id) # interpret group_id as a role
File "/home/maurice/web2py1/gluon/authapi.py", line 454, in id_group
rows = self.db(self.table_group().role == role).select()
File "/home/maurice/web2py1/gluon/packages/dal/pydal/objects.py", line 2395, in select
return adapter.select(self.query, fields, attributes)
File "/home/maurice/web2py1/gluon/packages/dal/pydal/adapters/base.py", line 763, in select
return self._select_aux(sql, fields, attributes, colnames)
File "/home/maurice/web2py1/gluon/packages/dal/pydal/adapters/base.py", line 719, in _select_aux
rows = self._select_aux_execute(sql)
File "/home/maurice/web2py1/gluon/packages/dal/pydal/adapters/base.py", line 713, in _select_aux_execute
self.execute(sql)
File "/home/maurice/web2py1/gluon/packages/dal/pydal/adapters/__init__.py", line 67, in wrap
return f(*args, **kwargs)
File "/home/maurice/web2py1/gluon/packages/dal/pydal/adapters/base.py", line 413, in execute
rv = self.cursor.execute(command, *args[1:], **kwargs)
psycopg2.errors.UndefinedTable: relation "auth_group" does not exist
LINE 1: ...th_group"."role", "auth_group"."description" FROM "auth_grou...

Clemens

unread,
Feb 13, 2020, 2:59:36 PM2/13/20
to web2py-users
Have you installed the corresponding python 3 lib for postgres?
pip3 install --no-binary :all: --upgrade psycopg2

What's your os? I'm using Linux and I switched to python 3, also using postgres and I have no problems with psycopg2.

Best regards
Clemens

Maurice Waka

unread,
Feb 14, 2020, 9:11:33 AM2/14/20
to web...@googlegroups.com
I removed postgresql and reinstalled it. Working well now.
Regards 

--
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 a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/TOaYVxBjX8s/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/df347779-fc06-434f-bd5c-dd7bff245ebc%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages