微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

pgAdmin4 在 OpenSUSE Leap 15.2 上不显示服务器连接

如何解决pgAdmin4 在 OpenSUSE Leap 15.2 上不显示服务器连接

我已经安装了官方包:

information for package pgadmin4:
---------------------------------
Repository     : openSUSE-Leap-15.2-1
Name           : pgadmin4
Version        : 4.1-lp152.2.9
Arch           : x86_64
vendor         : openSUSE
...

启动正常,打开浏览器标签

但是,当我尝试添加服务器连接时,没有任何反应。 “服务器”下没有任何内容

在某些时候,卸载、重新启动并再次安装后,连接会短暂显示,但随后又消失了。

在我的主目录中,我看到两个隐藏的日志文件.pgAdmin4.startup.log 不包含任何有趣的内容,只是报告一切已成功启动。另一个有以下说法:

2021-02-09 19:00:22,138: ERROR  werkzeug:   Error on request:
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/werkzeug/serving.py",line 271,in run_wsgi
    execute(self.server.app)
  File "/usr/lib/python3.6/site-packages/werkzeug/serving.py",line 259,in execute
    application_iter = app(environ,start_response)
  File "/usr/lib/python3.6/site-packages/flask/app.py",line 2309,in __call__
    return self.wsgi_app(environ,line 2295,in wsgi_app
    response = self.handle_exception(e)
  File "/usr/lib/python3.6/site-packages/flask/app.py",line 1741,in handle_exception
    reraise(exc_type,exc_value,tb)
  File "/usr/lib/python3.6/site-packages/flask/_compat.py",line 35,in reraise
    raise value
  File "/usr/lib/python3.6/site-packages/flask/app.py",line 2292,in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/lib/python3.6/site-packages/flask/app.py",line 1815,in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/lib/python3.6/site-packages/flask/app.py",line 1718,in handle_user_exception
    reraise(exc_type,line 1813,in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/lib/python3.6/site-packages/flask/app.py",line 1799,in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/lib/python3.6/site-packages/flask/views.py",line 88,in view
    return self.dispatch_request(*args,**kwargs)
  File "/usr/lib/python3.6/site-packages/pgadmin4-web/pgadmin/browser/utils.py",in dispatch_request
    return method(*args,line 309,in children
    children.extend(module.get_nodes(*args,**kwargs))
  File "/usr/lib/python3.6/site-packages/pgadmin4-web/pgadmin/browser/server_groups/servers/__init__.py",line 126,in get_nodes
    in_recovery,wal_paused = recovery_state(conn,manager.version)
  File "/usr/lib/python3.6/site-packages/pgadmin4-web/pgadmin/browser/server_groups/servers/__init__.py",line 51,in recovery_state
    status,result = connection.execute_dict(recovery_check_sql)
  File "/usr/lib/python3.6/site-packages/pgadmin4-web/pgadmin/utils/driver/psycopg2/connection.py",line 1199,in execute_dict
    desc.to_dict() for desc in cur.ordered_description()
  File "/usr/lib/python3.6/site-packages/pgadmin4-web/pgadmin/utils/driver/psycopg2/connection.py",in <listcomp>
    desc.to_dict() for desc in cur.ordered_description()
  File "/usr/lib/python3.6/site-packages/pgadmin4-web/pgadmin/utils/driver/psycopg2/cursor.py",line 94,in to_dict
    ores = OrderedDict(self.orig_col._asdict())
AttributeError: 'psycopg2.extensions.Column' object has no attribute '_asdict'

psycopg2 出现在 /usr/lib64/python3.6/site-packages

# pip show psycopg2
Name: psycopg2
Version: 2.8.5
Summary: psycopg2 - Python-Postgresql Database Adapter
Home-page: https://psycopg.org/
Author: Federico Di Gregorio
Author-email: fog@initd.org
License: LGPL with exceptions
Location: /usr/lib64/python3.6/site-packages
Requires: 
required-by: 

Postgresql 服务器在 podman 容器中运行,但这与问题几乎无关。此外,我可以使用 psql 进行连接。

有没有人遇到过类似的问题并修复了它?

解决方法

我发现了同样的问题。我发现了这个:pgadmin4 showing 500 (INTERNAL SERVER ERROR) 似乎 OpenSuse 更新了 psycopg2 的版本,但还没有更新 pgadmin4 的版本:(

就我而言,最简单的解决方法是使用 Fedora 的 rpm 包安装旧(兼容)版本的 psycopg2http://rpm.pbone.net/info_idpl_63870838_distro_redhat_el_7_com_python3-psycopg2-2.7.7-2.el7.x86_64.rpm.html

您可以使用 --oldpackage 标志安装它,例如: sudo zypper install --oldpackage python3-psycopg2-2.7.7-2.el7.x86_64.rpm

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。