当前位置: 首页 > 知识库问答 >
问题:

获取致命错误:运行pgAdmin4时无法联系服务器。“NoneType”对象没有属性“value”

孙文康
2023-03-14

我有一个新安装的窗口,我正在尝试安装Postgres和pgAdmin4。我使用默认设置重新安装了所有内容(pgAdmin 4、postrgres 13等)。当我运行pgAdmin 4时,我收到一个“致命错误:无法联系服务器”,其中包含以下消息:

pgAdmin Runtime Environment
--------------------------------------------------------
Python Path: "C:\Program Files\PostgreSQL\13\pgAdmin 4\python\python.exe"
Runtime Config File: "C:\Users\username\AppData\Roaming\pgadmin\runtime_config.json"
pgAdmin Config File: "C:\Program Files\PostgreSQL\13\pgAdmin 4\web\config.py"
Webapp Path: "C:\Program Files\PostgreSQL\13\pgAdmin 4\web\pgAdmin4.py"
pgAdmin Command: "C:\Program Files\PostgreSQL\13\pgAdmin 4\python\python.exe -s C:\Program Files\PostgreSQL\13\pgAdmin 4\web\pgAdmin4.py"
Environment: 
  - ALLUSERSPROFILE: C:\ProgramData
  - APPDATA: C:\Users\username\AppData\Roaming
  - CHROME_CRASHPAD_PIPE_NAME: \\.\pipe\crashpad_4296_YJZESWNMDVNGRRUO
  - CHROME_RESTART: NW.js|Whoa! NW.js has crashed. Relaunch now?|LEFT_TO_RIGHT
  - CommonProgramFiles: C:\Program Files\Common Files
  - CommonProgramFiles(x86): C:\Program Files (x86)\Common Files
  - CommonProgramW6432: C:\Program Files\Common Files
  - COMPUTERNAME: pcname
  - ComSpec: C:\Windows\system32\cmd.exe
  - configsetroot: C:\Windows\ConfigSetRoot
  - DriverData: C:\Windows\System32\Drivers\DriverData
  - HOMEDRIVE: C:
  - HOMEPATH: \Users\username
  - LOCALAPPDATA: C:\Users\username\AppData\Local
  - LOGONSERVER: \\pcname
  - NUMBER_OF_PROCESSORS: 8
  - NVM_HOME: C:\Users\username\AppData\Roaming\nvm
  - NVM_SYMLINK: C:\Program Files\nodejs
  - OneDrive: C:\Users\username\OneDrive
  - OS: Windows_NT
  - Path: C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Git\cmd;C:\Program Files\PostgreSQL\12\bin;C:\Users\username\AppData\Roaming\nvm;C:\Program Files\nodejs;C:\Users\username\AppData\Local\Microsoft\WindowsApps;C:\Users\username\AppData\Local\Programs\Microsoft VS Code\bin
  - PATHEXT: .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
  - PGADMIN_INT_KEY: 2e023387-9c82-4cdd-af2f-c82562c6e4fc
  - PGADMIN_INT_PORT: 50567
  - PGADMIN_SERVER_MODE: OFF
  - PROCESSOR_ARCHITECTURE: AMD64
  - PROCESSOR_IDENTIFIER: Intel64 Family 6 Model 140 Stepping 1, GenuineIntel
  - PROCESSOR_LEVEL: 6
  - PROCESSOR_REVISION: 8c01
  - ProgramData: C:\ProgramData
  - ProgramFiles: C:\Program Files
  - ProgramFiles(x86): C:\Program Files (x86)
  - ProgramW6432: C:\Program Files
  - PSModulePath: C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules
  - PUBLIC: C:\Users\Public
  - SystemDrive: C:
  - SystemRoot: C:\Windows
  - TEMP: C:\Users\username\AppData\Local\Temp
  - TMP: C:\Users\username\AppData\Local\Temp
  - USERDOMAIN: pcname
  - USERDOMAIN_ROAMINGPROFILE: pcname
  - USERNAME: username
  - USERPROFILE: C:\Users\username
  - windir: C:\Windows
--------------------------------------------------------

Traceback (most recent call last):
  File "C:\Program Files\PostgreSQL\13\pgAdmin 4\web\pgAdmin4.py", line 98, in <module>
    app = create_app()
  File "C:\Program Files\PostgreSQL\13\pgAdmin 4\web\pgadmin\__init__.py", line 347, in create_app
    if not os.path.exists(SQLITE_PATH) or get_version() == -1:
  File "C:\Program Files\PostgreSQL\13\pgAdmin 4\web\pgadmin\setup\db_version.py", line 19, in get_version
    return version.value
AttributeError: 'NoneType' object has no attribute 'value'

注意:'username'和'pcname'是我替换实际字符串的占位符,其中一些最初是大写的。

经过验证的服务“postgresql-x64-13”正在运行。尽管尝试了以下操作,但我仍继续收到此消息:

  • 以管理员身份运行。
  • 删除C:\用户\用户名\AppData\漫游\pgadmin
  • C:\Program Files\PostgreSQL\13\bin添加到PATH环境变量(系统和用户)
  • 重新启动服务。
  • 卸载/重新安装Postgres 13。
  • 卸载/安装Postgres 12。
  • 重启我的机器。

产生不同结果的一件事是停止服务,删除C:\ Users \ username \ AppData \ Roaming \ pg admin,重新启动服务,然后运行pg4admin,这导致了“致命错误”,输出如下:

pgAdmin Runtime Environment
--------------------------------------------------------
Python Path: "C:\Program Files\PostgreSQL\13\pgAdmin 4\python\python.exe"
Runtime Config File: "C:\Users\username\AppData\Roaming\pgadmin\runtime_config.json"
pgAdmin Config File: "C:\Program Files\PostgreSQL\13\pgAdmin 4\web\config.py"
Webapp Path: "C:\Program Files\PostgreSQL\13\pgAdmin 4\web\pgAdmin4.py"
pgAdmin Command: "C:\Program Files\PostgreSQL\13\pgAdmin 4\python\python.exe -s C:\Program Files\PostgreSQL\13\pgAdmin 4\web\pgAdmin4.py"
Environment: 
  - ALLUSERSPROFILE: C:\ProgramData
  - APPDATA: C:\Users\username\AppData\Roaming
  - CHROME_CRASHPAD_PIPE_NAME: \\.\pipe\crashpad_10312_CHCJAQAYYFQQIAGB
  - CHROME_RESTART: NW.js|Whoa! NW.js has crashed. Relaunch now?|LEFT_TO_RIGHT
  - CommonProgramFiles: C:\Program Files\Common Files
  - CommonProgramFiles(x86): C:\Program Files (x86)\Common Files
  - CommonProgramW6432: C:\Program Files\Common Files
  - COMPUTERNAME: pcname
  - ComSpec: C:\Windows\system32\cmd.exe
  - configsetroot: C:\Windows\ConfigSetRoot
  - DriverData: C:\Windows\System32\Drivers\DriverData
  - HOMEDRIVE: C:
  - HOMEPATH: \Users\username
  - LOCALAPPDATA: C:\Users\username\AppData\Local
  - LOGONSERVER: \\pcname
  - NUMBER_OF_PROCESSORS: 8
  - NVM_HOME: C:\Users\username\AppData\Roaming\nvm
  - NVM_SYMLINK: C:\Program Files\nodejs
  - OneDrive: C:\Users\username\OneDrive
  - OS: Windows_NT
  - Path: C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Git\cmd;C:\Program Files\PostgreSQL\13\bin;C:\Users\username\AppData\Roaming\nvm;C:\Program Files\nodejs;C:\Users\username\AppData\Local\Microsoft\WindowsApps;C:\Users\username\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\username\AppData\Roaming\nvm;C:\Program Files\nodejs;C:\Program Files\PostgreSQL\13\bin;
  - PATHEXT: .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
  - PGADMIN_INT_KEY: cb6cf8e1-ca8b-416b-985f-1fd1a945ff06
  - PGADMIN_INT_PORT: 50906
  - PGADMIN_SERVER_MODE: OFF
  - PROCESSOR_ARCHITECTURE: AMD64
  - PROCESSOR_IDENTIFIER: Intel64 Family 6 Model 140 Stepping 1, GenuineIntel
  - PROCESSOR_LEVEL: 6
  - PROCESSOR_REVISION: 8c01
  - ProgramData: C:\ProgramData
  - ProgramFiles: C:\Program Files
  - ProgramFiles(x86): C:\Program Files (x86)
  - ProgramW6432: C:\Program Files
  - PSModulePath: C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules
  - PUBLIC: C:\Users\Public
  - SESSIONNAME: Console
  - SystemDrive: C:
  - SystemRoot: C:\Windows
  - TEMP: C:\Users\username\AppData\Local\Temp
  - TMP: C:\Users\username\AppData\Local\Temp
  - USERDOMAIN: pcname
  - USERDOMAIN_ROAMINGPROFILE: pcname
  - USERNAME: username
  - USERPROFILE: C:\Users\username
  - windir: C:\Windows
--------------------------------------------------------

NOTE: Configuring authentication for DESKTOP mode.

Traceback (most recent call last):
  File "C:\Program Files\PostgreSQL\13\pgAdmin 4\web\pgAdmin4.py", line 91, in <module>
    exec(open(file_quote(setup_py), 'r').read())
  File "<string>", line 506, in <module>
  File "<string>", line 378, in setup_db
  File "C:\Program Files\PostgreSQL\13\pgAdmin 4\web\pgadmin\__init__.py", line 351, in create_app
    db_upgrade(app)
  File "C:\Program Files\PostgreSQL\13\pgAdmin 4\web\pgadmin\setup\db_upgrade.py", line 25, in db_upgrade
    flask_migrate.upgrade(migration_folder)
  File "C:\Program Files\PostgreSQL\13\pgAdmin 4\python\lib\site-packages\flask_migrate\__init__.py", line 96, in wrapped
    f(*args, **kwargs)
  File "C:\Program Files\PostgreSQL\13\pgAdmin 4\python\lib\site-packages\flask_migrate\__init__.py", line 271, in upgrade
    command.upgrade(config, revision, sql=sql, tag=tag)
  File "C:\Program Files\PostgreSQL\13\pgAdmin 4\python\lib\site-packages\alembic\command.py", line 294, in upgrade
    script.run_env()
  File "C:\Program Files\PostgreSQL\13\pgAdmin 4\python\lib\site-packages\alembic\script\base.py", line 490, in run_env
    util.load_python_file(self.dir, "env.py")
  File "C:\Program Files\PostgreSQL\13\pgAdmin 4\python\lib\site-packages\alembic\util\pyfiles.py", line 97, in load_python_file
    module = load_module_py(module_id, path)
  File "C:\Program Files\PostgreSQL\13\pgAdmin 4\python\lib\site-packages\alembic\util\compat.py", line 182, in load_module_py
    spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "C:\Program Files\PostgreSQL\13\pgAdmin 4\web\pgadmin\setup\..\..\migrations\env.py", line 93, in <module>
    run_migrations_online()
  File "C:\Program Files\PostgreSQL\13\pgAdmin 4\web\pgadmin\setup\..\..\migrations\env.py", line 86, in run_migrations_online
    context.run_migrations()
  File "<string>", line 8, in run_migrations
  File "C:\Program Files\PostgreSQL\13\pgAdmin 4\python\lib\site-packages\alembic\runtime\environment.py", line 813, in run_migrations
    self.get_context().run_migrations(**kw)
  File "C:\Program Files\PostgreSQL\13\pgAdmin 4\python\lib\site-packages\alembic\runtime\migration.py", line 561, in run_migrations
    step.migration_fn(**kw)
  File "C:\Program Files\PostgreSQL\13\pgAdmin 4\web\migrations\versions\fdc58d9bd449_.py", line 122, in upgrade
    Security(current_app, user_datastore, register_blueprint=False)
  File "C:\Program Files\PostgreSQL\13\pgAdmin 4\python\lib\site-packages\flask_security\core.py", line 1062, in __init__
    self._state = self.init_app(
  File "C:\Program Files\PostgreSQL\13\pgAdmin 4\python\lib\site-packages\flask_security\core.py", line 1102, in init_app
    self._state = state = _get_state(app, datastore, **kwargs)
  File "C:\Program Files\PostgreSQL\13\pgAdmin 4\python\lib\site-packages\flask_security\core.py", line 608, in _get_state
    remember_token_serializer=_get_serializer(app, "remember"),
  File "C:\Program Files\PostgreSQL\13\pgAdmin 4\python\lib\site-packages\flask_security\core.py", line 593, in _get_serializer
    return URLSafeTimedSerializer(secret_key=secret_key, salt=salt)
  File "C:\Program Files\PostgreSQL\13\pgAdmin 4\python\lib\site-packages\itsdangerous\serializer.py", line 104, in __init__
    self.secret_keys: _t.List[bytes] = _make_keys_list(secret_key)
  File "C:\Program Files\PostgreSQL\13\pgAdmin 4\python\lib\site-packages\itsdangerous\signer.py", line 64, in _make_keys_list
    return [want_bytes(s) for s in secret_key]
TypeError: 'NoneType' object is not iterable

我最近在另一台机器上安装了它,没有任何问题。看起来奇怪的是,一个新的构建会有问题。几乎让我觉得我缺少旧版本包含的东西(python?),尽管不应该是这样。关于这一点,有很多帖子,我已经尝试了其中的所有建议,但没有解决方案。

共有3个答案

隆飞宇
2023-03-14

我也有这个问题。我按照nonethewiser的建议答案,安装了独立的pgAdmin。删除Roaming/pgadmin并以admin身份启动后,它不起作用。我再次尝试捆绑的pgAdmin,奇怪的是,它工作了。

姚嘉容
2023-03-14

最后,对我有效的解决方案是:

  1. 删除C:\Users\username\AppData\Roaming\pgadmin
  2. 打开终端并使用python运行C:\Program Files\PostgreSQL\12\pgAdmin 4\web\pgAdmin4.py文件

终端视图-

唐俊爽
2023-03-14

正如Delsx在评论中指出的,可以在pgAdmin.org/download中安装独立的pgAdmin,而不会出现同样的问题。这似乎是pgAdmin错误列表中报告的一个广泛的错误,这里和这里

 类似资料:
  • 我遇到了这个错误,它不允许我在表单中保存信息。初始数据在表单中显示良好,但保存起来很困难。希望有人能帮忙,我真的被困了 追踪: 内部 41 中的文件“C:\程序文件\Python35\lib\site-packages\django\core\处理程序\exception.py”。响应 = get_response(请求) 文件"C:\Program Files\Python35\lib\site

  • 我是硒网络驱动程序的新手,目前使用Python来编写脚本。现在我想应用参数,我使用Excel应用了数据驱动方法。基本上只有第一个循环ok,它可以读取和写入第一行的数据,但之后不能。 首先,我在Python文件中创建它(作为新模块): 接下来,我编写以下代码以在登录和注销过程中包含数据驱动测试: 我得到了错误属性错误:“NoneType”对象没有属性“send_keys”,所以我认为包括等待/睡眠可

  • 我知道这个问题可能会被标记为重复,但请记住,我已经搜索了许多张贴的解决方案,我的错误还没有得到修复。 当启动postgres时,我得到以下错误: 无法联系postgresql应用服务器。 当以管理员身份运行时,错误被“解决”,但应用程序在另一个端口打开--有时它在50142、51120打开,其他端口在50859打开--。当它在另一个端口上打开时(就像前面说的那样),它要求输入连接到服务器的密码,我

  • 我想在windows 7上安装PostgreSQL。然而,当我准备发布pgAdmin 4时,我遇到了一个问题。它显示“致命错误。无法联系应用程序服务器。我尝试以管理员身份运行,删除了AppData中的文件pgAdmin。删除了python和我的路径。在我的路径中添加了PostgreAQL。然而,由于某种原因,它显示了上述问题。我需要你帮我。先谢谢你了

  • 如果pk_col值为空,则应打印未定义的主键。但我得到了这个错误。“NoneType”对象没有属性“rdd”。

  • 我是一个新的程序员,我一直在学习如何创建一个不和谐机器人的教程,下面的代码实际上是直接从教程中复制出来的,我已经创建了一个. env文件来存储我的AuthToken。每次我运行代码,我得到的错误低于上述代码。有什么提示吗?提前感谢! 代码: 错误: