public inbox for [email protected]  
help / color / mirror / Atom feed
[pgAdmin] Fix incorrect import in setup.py
3+ messages / 3 participants
[nested] [flat]

* [pgAdmin] Fix incorrect import in setup.py
@ 2020-09-24 08:01  Azad Salahlı <[email protected]>
  0 siblings, 1 reply; 3+ messages in thread

From: Azad Salahlı @ 2020-09-24 08:01 UTC (permalink / raw)
  To: pgadmin-hackers

Hi,

First time posting here. I've attached a fix for an incorrect import
in `setup.py`. Trying to import from `pgadmin` before adding the root
directory to the system path results in import error, when the script
is invoked in any other way than running it directly. For example

    $ /path/to/venv/bin/pip install pgadmin4
    $ /path/to/venv/bin/python -m pgadmin4.setup
    Traceback (most recent call last):
      ...
      File "/path/to/venv/lib/python3.6/site-packages/pgadmin4/setup.py",
line 18, in <module>
        from pgadmin.model import db, User, Version, ServerGroup, Server, \
    ModuleNotFoundError: No module named 'pgadmin'

Please let me know what you think. Happy to address any feedback.

Regards,
Azad Salahlı

diff --git a/web/setup.py b/web/setup.py
index 4cd090d15..fbc7f1e04 100644
--- a/web/setup.py
+++ b/web/setup.py
@@ -15,8 +15,6 @@ import json
 import os
 import sys
 import builtins
-from pgadmin.model import db, User, Version, ServerGroup, Server, \
-    SCHEMA_VERSION as CURRENT_SCHEMA_VERSION
 
 # Grab the SERVER_MODE if it's been set by the runtime
 if 'SERVER_MODE' in globals():
@@ -31,6 +29,8 @@ if sys.path[0] != root:
     sys.path.insert(0, root)
 
 from pgadmin import create_app
+from pgadmin.model import db, User, Version, ServerGroup, Server, \
+    SCHEMA_VERSION as CURRENT_SCHEMA_VERSION
 
 
 def add_value(attr_dict, key, value):


Attachments:

  [text/plain] import_fix.diff (652B, 2-import_fix.diff)
  download | inline diff:
diff --git a/web/setup.py b/web/setup.py
index 4cd090d15..fbc7f1e04 100644
--- a/web/setup.py
+++ b/web/setup.py
@@ -15,8 +15,6 @@ import json
 import os
 import sys
 import builtins
-from pgadmin.model import db, User, Version, ServerGroup, Server, \
-    SCHEMA_VERSION as CURRENT_SCHEMA_VERSION
 
 # Grab the SERVER_MODE if it's been set by the runtime
 if 'SERVER_MODE' in globals():
@@ -31,6 +29,8 @@ if sys.path[0] != root:
     sys.path.insert(0, root)
 
 from pgadmin import create_app
+from pgadmin.model import db, User, Version, ServerGroup, Server, \
+    SCHEMA_VERSION as CURRENT_SCHEMA_VERSION
 
 
 def add_value(attr_dict, key, value):


^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: [pgAdmin] Fix incorrect import in setup.py
@ 2020-09-28 11:18  Aditya Toshniwal <[email protected]>
  parent: Azad Salahlı <[email protected]>
  0 siblings, 1 reply; 3+ messages in thread

From: Aditya Toshniwal @ 2020-09-28 11:18 UTC (permalink / raw)
  To: Azad Salahlı <[email protected]>; +Cc: pgadmin-hackers

Hi Azad,

The patch looks good to me.

On Thu, Sep 24, 2020 at 6:33 PM Azad Salahlı <[email protected]> wrote:

> Hi,
>
> First time posting here. I've attached a fix for an incorrect import
> in `setup.py`. Trying to import from `pgadmin` before adding the root
> directory to the system path results in import error, when the script
> is invoked in any other way than running it directly. For example
>
>     $ /path/to/venv/bin/pip install pgadmin4
>     $ /path/to/venv/bin/python -m pgadmin4.setup
>     Traceback (most recent call last):
>       ...
>       File "/path/to/venv/lib/python3.6/site-packages/pgadmin4/setup.py",
> line 18, in <module>
>         from pgadmin.model import db, User, Version, ServerGroup, Server, \
>     ModuleNotFoundError: No module named 'pgadmin'
>
> Please let me know what you think. Happy to address any feedback.
>
> Regards,
> Azad Salahlı
>


-- 
Thanks,
Aditya Toshniwal
pgAdmin hacker | Sr. Software Engineer | *edbpostgres.com*
<http://edbpostgres.com;
"Don't Complain about Heat, Plant a TREE"


^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: [pgAdmin] Fix incorrect import in setup.py
@ 2020-09-28 12:26  Akshay Joshi <[email protected]>
  parent: Aditya Toshniwal <[email protected]>
  0 siblings, 0 replies; 3+ messages in thread

From: Akshay Joshi @ 2020-09-28 12:26 UTC (permalink / raw)
  To: Aditya Toshniwal <[email protected]>; +Cc: Azad Salahlı <[email protected]>; pgadmin-hackers

Thanks, patch applied.

On Mon, Sep 28, 2020 at 4:48 PM Aditya Toshniwal <
[email protected]> wrote:

> Hi Azad,
>
> The patch looks good to me.
>
> On Thu, Sep 24, 2020 at 6:33 PM Azad Salahlı <[email protected]>
> wrote:
>
>> Hi,
>>
>> First time posting here. I've attached a fix for an incorrect import
>> in `setup.py`. Trying to import from `pgadmin` before adding the root
>> directory to the system path results in import error, when the script
>> is invoked in any other way than running it directly. For example
>>
>>     $ /path/to/venv/bin/pip install pgadmin4
>>     $ /path/to/venv/bin/python -m pgadmin4.setup
>>     Traceback (most recent call last):
>>       ...
>>       File "/path/to/venv/lib/python3.6/site-packages/pgadmin4/setup.py",
>> line 18, in <module>
>>         from pgadmin.model import db, User, Version, ServerGroup, Server,
>> \
>>     ModuleNotFoundError: No module named 'pgadmin'
>>
>> Please let me know what you think. Happy to address any feedback.
>>
>> Regards,
>> Azad Salahlı
>>
>
>
> --
> Thanks,
> Aditya Toshniwal
> pgAdmin hacker | Sr. Software Engineer | *edbpostgres.com*
> <http://edbpostgres.com;
> "Don't Complain about Heat, Plant a TREE"
>


-- 
*Thanks & Regards*
*Akshay Joshi*
*pgAdmin Hacker | Sr. Software Architect*
*EDB Postgres <http://edbpostgres.com>*

*Mobile: +91 976-788-8246*


^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2020-09-28 12:26 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-09-24 08:01 [pgAdmin] Fix incorrect import in setup.py Azad Salahlı <[email protected]>
2020-09-28 11:18 ` Aditya Toshniwal <[email protected]>
2020-09-28 12:26   ` Akshay Joshi <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox