Ubuntu
AttributeError:“NoneType”對像沒有屬性“值”-pgAdmin4
我 Ctrl+C 退出了最初的 pgAdmin4 設置。
python pgAdmin4.py
現在,如果我嘗試重新執行安裝,我會遇到大量錯誤。我現在正在使用 pgAdmin3,但我想知道如何解決這個問題。完整的回溯如下:Traceback (most recent call last): File "pgAdmin4.py", line 37, in <module> app = create_app() File "/home/sean/.virtualenvs/pgadmin/lib/python2.7/site-packages/pgadmin4/pgadmin/__init__.py", line 244, in create_app db_upgrade(app) File "/home/sean/.virtualenvs/pgadmin/lib/python2.7/site-packages/pgadmin4/pgadmin/setup/db_upgrade.py", line 25, in db_upgrade flask_migrate.upgrade(migration_folder) File "/home/sean/.virtualenvs/pgadmin/local/lib/python2.7/site-packages/flask_migrate/__init__.py", line 244, in upgrade command.upgrade(config, revision, sql=sql, tag=tag) File "/home/sean/.virtualenvs/pgadmin/local/lib/python2.7/site-packages/alembic/command.py", line 254, in upgrade script.run_env() File "/home/sean/.virtualenvs/pgadmin/local/lib/python2.7/site-packages/alembic/script/base.py", line 421, in run_env util.load_python_file(self.dir, 'env.py') File "/home/sean/.virtualenvs/pgadmin/local/lib/python2.7/site-packages/alembic/util/pyfiles.py", line 93, in load_python_file module = load_module_py(module_id, path) File "/home/sean/.virtualenvs/pgadmin/local/lib/python2.7/site-packages/alembic/util/compat.py", line 75, in load_module_py mod = imp.load_source(module_id, path, fp) File "/home/sean/.virtualenvs/pgadmin/lib/python2.7/site-packages/pgadmin4/pgadmin/setup/../../migrations/env.py", line 94, in <module> run_migrations_online() File "/home/sean/.virtualenvs/pgadmin/lib/python2.7/site-packages/pgadmin4/pgadmin/setup/../../migrations/env.py", line 87, in run_migrations_online context.run_migrations() File "<string>", line 8, in run_migrations File "/home/sean/.virtualenvs/pgadmin/local/lib/python2.7/site-packages/alembic/runtime/environment.py", line 817, in run_migrations self.get_context().run_migrations(**kw) File "/home/sean/.virtualenvs/pgadmin/local/lib/python2.7/site-packages/alembic/runtime/migration.py", line 329, in run_migrations step.migration_fn(**kw) File "/home/sean/.virtualenvs/pgadmin/lib/python2.7/site-packages/pgadmin4/migrations/versions/fdc58d9bd449_.py", line 34, in upgrade if get_version() != -1: File "/home/sean/.virtualenvs/pgadmin/lib/python2.7/site-packages/pgadmin4/pgadmin/setup/db_version.py", line 21, in get_version if int(version.value) > int(config.SETTINGS_SCHEMA_VERSION): AttributeError: 'NoneType' object has no attribute 'value'
我執行了相同的步驟並遇到了同樣的問題。我發現通過刪除 ~/.pgadmin 目錄(在安裝過程中創建)然後重新執行“python pgAdmin4.py”解決了問題
我想提供另一個相同的可能答案。
像 OP 一樣,我從設置中按 CTRL+C 並在重新啟動設置後開始出現相同的異常。
if int(version.value) > int(config.SETTINGS_SCHEMA_VERSION): AttributeError: 'NoneType' object has no attribute 'value'
就我而言,我
config_local.py
在 default 旁邊有一個config.py
. 其中一條是:SQLITE_PATH = '/opt/pgadmin4/pgadmin4.db'
刪除指向的文件的解決方案
SQLITE_PATH
。