From 718ac028066c64cdc6bc977bf5ddd02857561100 Mon Sep 17 00:00:00 2001 From: Cyril Jouve Date: Tue, 27 Apr 2021 12:54:57 +0530 Subject: [PATCH] =?UTF-8?q?Fixed=C2=A0ModuleNotFoundError=20when=20running?= =?UTF-8?q?=20setup.py=20from=20outside=20of=20the=20root.=20Fixes=20#6408?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/en_US/release_notes_5_3.rst | 1 + web/setup.py | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/en_US/release_notes_5_3.rst b/docs/en_US/release_notes_5_3.rst index 2d637b7a4..da521d475 100644 --- a/docs/en_US/release_notes_5_3.rst +++ b/docs/en_US/release_notes_5_3.rst @@ -21,3 +21,4 @@ Bug fixes | `Issue #6341 `_ - Fixed an issue where CSV download quotes the numeric columns. | `Issue #6377 `_ - Fixed an issue where schema diff does not create DROP DEFAULT statement for columns. | `Issue #6385 `_ - Ensure that Backup and Restore should work on shared servers. +| `Issue #6408 `_ - Fixed ModuleNotFoundError when running setup.py from outside of the root. diff --git a/web/setup.py b/web/setup.py index 828b68f11..d2735cbc0 100644 --- a/web/setup.py +++ b/web/setup.py @@ -10,9 +10,6 @@ """Perform the initial setup of the application, by creating the auth and settings database.""" -from pgadmin.model import db, User, Version, ServerGroup, Server, \ - SCHEMA_VERSION as CURRENT_SCHEMA_VERSION -from pgadmin import create_app import argparse import json import os @@ -33,6 +30,10 @@ root = os.path.dirname(os.path.realpath(__file__)) if sys.path[0] != root: sys.path.insert(0, root) +from pgadmin.model import db, User, Version, ServerGroup, Server, \ + SCHEMA_VERSION as CURRENT_SCHEMA_VERSION +from pgadmin import create_app + def add_value(attr_dict, key, value): """Add a value to the attribute dict if non-empty.