AttributeError: 'NoneType' object has no attribute 'value' - pgAdmin4
Question
I Ctrl+C'd out of the initial pgAdmin4 setup aka. python pgAdmin4.py
and now if I try to rerun the install, I get a mountain of errors. I'm using pgAdmin3 for now but I would like to know how to fix this. The full traceback is below:
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'
Solution
I performed the same steps and ran into the same problem. I found that the problem was resolved by removing the ~/.pgadmin directory (created during installation) and then re-running "python pgAdmin4.py"
OTHER TIPS
I want to offer another possible answer that is in the same vein.
Like the OP, I CTRL+C'ed from the setup & started to get the same exception after restarting setup.
if int(version.value) > int(config.SETTINGS_SCHEMA_VERSION):
AttributeError: 'NoneType' object has no attribute 'value'
In my case, I have a config_local.py
next to the default config.py
. One of the lines is:
SQLITE_PATH = '/opt/pgadmin4/pgadmin4.db'
The solution it to remove the file pointed by SQLITE_PATH
.