public inbox for [email protected]  
help / color / mirror / Atom feed
From: Nikhil Mohite <[email protected]>
To: pgadmin-hackers <[email protected]>
Cc: Fahar Abbas <[email protected]>
Cc: Akshay Joshi <[email protected]>
Cc: Dave Page <[email protected]>
Subject: Re: [pgAdmin][RM-2341]: Add menu option for starting PSQL
Date: Mon, 14 Jun 2021 10:54:54 +0530
Message-ID: <CAOBg0AP1NLfkiF30R6zddrficHRkOsfa3127sGTChJrigWgYEA@mail.gmail.com> (raw)
In-Reply-To: <CAOBg0APg0nvq0XfihscQLdJ+Vz5S2gDa2qfwROCLC=kYNXDQEg@mail.gmail.com>
References: <CAOBg0AO6Tjksb+EOA_-O13yRzdL_2d3y6G74m=GGQS+Ymjv=0g@mail.gmail.com>
	<CA+OCxow9+UDMrsBBvJKW2AeAYaN4cO3w7kBGNKtsWhSM6_D7gQ@mail.gmail.com>
	<CAOBg0AMVyLBma8wsbZ-VQWF4q3OAhqWeRLpmrxVcM_YOKH+MDQ@mail.gmail.com>
	<CANxoLDd2xMu7ym9PFdhYUSy4ucNuPoZ2fvaRkuwyB+EqowLXwA@mail.gmail.com>
	<CA+OCxowoz1oFE=eMKEnfFtf=oDrkPKHGfZpUGRW-sG_tpfMBTw@mail.gmail.com>
	<CAOBg0ANFNvtD-LoFxXcLY5JJ4BVH5zNyrmdBED6B++-nKf012g@mail.gmail.com>
	<CA+OCxowW7BEZzULbEpn73ygqWtWkUwdCAB3PMcHocUeQXcM3ow@mail.gmail.com>
	<CAOBg0APGPTA4qNNryAXMwKP63uFLxQdQwnFdDXMjSr4OeH-HAg@mail.gmail.com>
	<CA+OCxozYus58i3BhP37E-2Xc6Nq5zrJegcq+eANWpvN++_LtXw@mail.gmail.com>
	<CAOBg0AO7NfJjLLFD8g5NkkbbnKiCSR5g9yshxc-65sWk2sFyBA@mail.gmail.com>
	<CA+OCxoxdaBmh6e4Fo1F_+vZExq8SPUyGAByRzOPy2kz_vgRiSA@mail.gmail.com>
	<CAOBg0AO6A10OHiQAOOguagW1mNzfK1oVPHG9W+JSCkYjR+xQkA@mail.gmail.com>
	<CA+OCxoxpyfJabnycSGmtUK1-QEndNfZV3q2d1xP-oftDn-pGDw@mail.gmail.com>
	<CANxoLDexHsJQcrd6ZrkjCub+xj_Ke+dDp_Av5no84MOJH1uC_g@mail.gmail.com>
	<CAOBg0AN6Gb9gp1F=jKeefAz6d0U2GSjC40qAJ8i7psor2KmQLA@mail.gmail.com>
	<CANxoLDd3QdOPY7Y6kDCSy99s3DFrbdhP9LNxphsEg9B5G14Dbg@mail.gmail.com>
	<CAOBg0AN3eSLvS_cG7R3WiTpfBxiJfi2YB6sV8NBWiakioXRAsQ@mail.gmail.com>
	<CANxoLDdGeNOBZJu-v9YaefKeTSGcCcU2DQic1MQU9jYYLJ6K_Q@mail.gmail.com>
	<CAOBg0AO-gsDJSrLoGPJGKsq772Okgg3BWDuERaaGSDvoGbhQAA@mail.gmail.com>
	<CA+OCxozEBo7-8hSeWo8K9mAL5E5MkeW3JG+JnjJXMEkT6q8SNg@mail.gmail.com>
	<CANxoLDcfbqO5qYOV=LE8x1ocVEUoLD7bCm_UXYHmXL2=n9kX7A@mail.gmail.com>
	<CAOBg0ANMJTzaEQdcEwUnLLGJXSbsT6=0L8Jvs_MTuBTfj0YtrQ@mail.gmail.com>
	<CANxoLDcjno=sUmj11QSEv8OYCSoiOtMVvHjo=jrWjumBPtk6RA@mail.gmail.com>
	<CAOBg0AMqZwQZoaxNHFn2cL0yHtfW04=RDYw-UqvjG-vA4KHmBA@mail.gmail.com>
	<CA+OCxoypWKk=5uST1gQEyYpYfgiX4=_EVSpy6o+AF8LErMd3pA@mail.gmail.com>
	<CAOBg0ANY6j0MHeSx0tOyrBz_+ZGH_zVYaB8+O0O6=qQ5f_BcVw@mail.gmail.com>
	<CA+OCxoyqJeMUFU4bujdUM9kcjSGngENeD4DuvLHu7ks_EQGhHw@mail.gmail.com>
	<CAOBg0ANz0XJ1j-YArXN6xUkbm2WhV0p-yX3Pw5emxk7EUpN4WA@mail.gmail.com>
	<CA+OCxoyAd7TUNjs6xyUrDR32YKNhfJTzzzH4JP=StKw0PoVXVQ@mail.gmail.com>
	<CAJFwRrOwY3wskN_A_VvU+gGzDYXrGkw8wFbD3xrd===WxFX_gg@mail.gmail.com>
	<CA+OCxoytJ_XXYPwq-=OmRiimbSrXz1Jjb+4z-pHgLBpcK=3bbQ@mail.gmail.com>
	<CAJFwRrMcivZdFBnsPWs7WZuFziCBBq-bWNQKbDDXfvV7d41svQ@mail.gmail.com>
	<CA+OCxoxUnPV61uxNVWniQLtfXZxkf-oz2Tzw6-PgZazP8g4Phw@mail.gmail.com>
	<CAJFwRrPJvbBQ9PjjtavQvv7OW_FQak7LG4E1HR3seH5+Nzck=g@mail.gmail.com>
	<CA+OCxoxqpCXKfDO5DKNUWWCeK+v8zosW8HZif=ReGQmBWynjFg@mail.gmail.com>
	<CAJFwRrNw8jTx0eNP+1GX6C_4nzpchM0_zqE5oHY8c3ipCwDejw@mail.gmail.com>
	<CA+OCxoxMYB2uVg8AfUm9mYtKpps1f+8YxZZaQwT2cK0njrjbGQ@mail.gmail.com>
	<CAOBg0APg0nvq0XfihscQLdJ+Vz5S2gDa2qfwROCLC=kYNXDQEg@mail.gmail.com>

Hi Team,

PFA patch v8

On Mon, Jun 14, 2021 at 10:25 AM Nikhil Mohite <
[email protected]> wrote:

> Hi Team,
>
> Please find the updated patch for the PSQL tool, Added check if the
> Windows version is not supporting the ConPty or WinPty disable the PSQL for
> that version. (PSQL option will not visible to the user).
>
> I have raised the issue with "pywinpty"
> https://github.com/spyder-ide/pywinpty/issues/161
>
> Regards,
> Nikhil Mohite
>
> On Fri, Jun 11, 2021 at 6:25 PM Dave Page <[email protected]> wrote:
>
>> Hi
>>
>> On Fri, Jun 11, 2021 at 1:45 PM Fahar Abbas <[email protected]>
>> wrote:
>>
>>> Hi Dave,
>>>
>>> On Fri, Jun 11, 2021 at 1:39 PM Dave Page <[email protected]> wrote:
>>>
>>>>
>>>>
>>>> On Fri, Jun 11, 2021 at 9:35 AM Fahar Abbas <
>>>> [email protected]> wrote:
>>>>
>>>>> Sure Dave, I will create a new VM with the latest iso.
>>>>>
>>>>
>>>> Not the latest. 1809 please. And if that doesn't work, 1909. We need to
>>>> understand exactly what versions work and which don't.
>>>>
>>>> pgadmin4 is working fine on Windows 10 x64(1809).
>>>
>>
>> Great, thanks!
>>
>>
>>>
>>> Do I also need to test pgadmin4 on 1909  iso?
>>>
>>
>> I don't think so. I'm 99% certain that what we're seeing is that it works
>> on the versions of Windows that support conpty, but not the older ones
>> where the pywinpty library is *supposed* to fall back to using winpty.
>>
>> Hopefully Nikhil can get to the bottom of the problem with the
>> pywinpty folks.
>>
>>
>>
>>>
>>>>
>>>>> Nikhil is not able to reproduce the issue on Windows 10 with the
>>>>> latest version. So the issue is reproducible with older versions.
>>>>>
>>>>> Kind Regards,
>>>>> On Fri, Jun 11, 2021 at 1:28 PM Dave Page <[email protected]> wrote:
>>>>>
>>>>>>
>>>>>>
>>>>>> On Fri, Jun 11, 2021 at 9:25 AM Fahar Abbas <
>>>>>> [email protected]> wrote:
>>>>>>
>>>>>>> Windows 10 Enterprise 2016 LTSB.
>>>>>>>
>>>>>>
>>>>>> Hmm, I assume that is version 1607. Can you test with 1809 please?
>>>>>> And if that doesn't work, try 1909.
>>>>>>
>>>>>>
>>>>>>>
>>>>>>> On Fri, Jun 11, 2021 at 1:12 PM Dave Page <[email protected]> wrote:
>>>>>>>
>>>>>>>> Hi
>>>>>>>>
>>>>>>>> On Fri, Jun 11, 2021 at 7:44 AM Fahar Abbas <
>>>>>>>> [email protected]> wrote:
>>>>>>>>
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>> pgadmin4 is failing on following operating systems :
>>>>>>>>> Windows 2016
>>>>>>>>> Windows 2012
>>>>>>>>> Windows 07
>>>>>>>>> Windows 2008R2
>>>>>>>>> Windows 10 64
>>>>>>>>>
>>>>>>>>
>>>>>>>> What version of Windows 10? I *think* conpty was introduced in 1809.
>>>>>>>>
>>>>>>>>
>>>>>>>>>
>>>>>>>>> pgadmin4 is working fine in following operating system:
>>>>>>>>> Windows 2019
>>>>>>>>>
>>>>>>>>> On Thu, Jun 10, 2021 at 7:51 PM Dave Page <[email protected]>
>>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On Thu, Jun 10, 2021 at 2:22 PM Nikhil Mohite <
>>>>>>>>>> [email protected]> wrote:
>>>>>>>>>>
>>>>>>>>>>> Hi Dave,
>>>>>>>>>>>
>>>>>>>>>>> On Thu, Jun 10, 2021 at 6:37 PM Dave Page <[email protected]>
>>>>>>>>>>> wrote:
>>>>>>>>>>>
>>>>>>>>>>>> Hi
>>>>>>>>>>>>
>>>>>>>>>>>> On Thu, Jun 10, 2021 at 2:00 PM Nikhil Mohite <
>>>>>>>>>>>> [email protected]> wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>> Hi Dave,
>>>>>>>>>>>>>
>>>>>>>>>>>>> On Thu, Jun 10, 2021 at 5:22 PM Dave Page <[email protected]>
>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>>> Hi
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> On Thu, Jun 10, 2021 at 11:08 AM Nikhil Mohite <
>>>>>>>>>>>>>> [email protected]> wrote:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Hi Dave/ Team,
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> We are facing an issue with winpty.dll on Windows server
>>>>>>>>>>>>>>> 2016 and Windows 7(these are platforms on which we have tested).
>>>>>>>>>>>>>>> Files required for winpty are present in the site-packages
>>>>>>>>>>>>>>> but still, it is unable to load the winpty.dll file on these specific
>>>>>>>>>>>>>>> platforms. We have tested it on Windows 10 pro and Windows server 2019 and
>>>>>>>>>>>>>>> it is working fine. (Also tried building the local pywinpty but unable to
>>>>>>>>>>>>>>> build it.)  ref link for winPty
>>>>>>>>>>>>>>> https://github.com/rprichard/winpty#:~:text=winpty%20is%20a%20Windows%20software,in%20a%20Cygwin%2FM....
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Does winpty.exe run, if executed from the command line
>>>>>>>>>>>>>> instead of pgAdmin? If not, does dependency walker show any missing
>>>>>>>>>>>>>> libraries that are required?
>>>>>>>>>>>>>>
>>>>>>>>>>>>> Not found the winpty.exe in site packages, but as per the
>>>>>>>>>>>>> winpty documents "winpty-agent.exe" will start the process with a new,
>>>>>>>>>>>>> hidden console window. It is not showing any error while installing the
>>>>>>>>>>>>> package. I tried to use it outside the pgAdmin but still facing the same
>>>>>>>>>>>>> error "Exception in import winpty DLL load failed while importing winpty:
>>>>>>>>>>>>> The specified procedure could not be found."(created a separate python
>>>>>>>>>>>>> environment for this)
>>>>>>>>>>>>>
>>>>>>>>>>>>> 1. if try to run winpty-agent.exe from the command line, it
>>>>>>>>>>>>> shows the user entered inputs on the same terminal, not showing any errors.
>>>>>>>>>>>>> [image: image.png]
>>>>>>>>>>>>>
>>>>>>>>>>>>> 2. I found winpty.exe in the other installed app (Git command
>>>>>>>>>>>>> line: C:\Program Files (x86)\Git\usr\bin) if try to run it through the
>>>>>>>>>>>>> command line not getting any error, it is showing user entered inputs on
>>>>>>>>>>>>> the same terminal. (It is not related to pgAdmin but just tried to check
>>>>>>>>>>>>> winpty.exe throwing any error or not)
>>>>>>>>>>>>> [image: image.png]
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> Hmmm, that sounds oddly similar to an issue I had with Kerberos
>>>>>>>>>>>> on Windows when I was mucking around with that. I can't remember the exact
>>>>>>>>>>>> details, but as a test, does the problem go away if winpty.dll is copied
>>>>>>>>>>>> into the Windows system32 directory?
>>>>>>>>>>>>
>>>>>>>>>>> Tried it but still facing the same issue.
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> OK, I had a fiddle around, and see the same thing. I can't do a
>>>>>>>>>> simple import of winpty. On 2019 it's fine. I tried various tricks that
>>>>>>>>>> I've used in the past to make sure libraries are found etc.
>>>>>>>>>>
>>>>>>>>>> Could this be because it's trying to use the conpty interface in
>>>>>>>>>> Windows 10 and above?
>>>>>>>>>>
>>>>>>>>>> If we can't get this to work tomorrow, I think it's fine to
>>>>>>>>>> simply hide the menu options and button if the server detects it's running
>>>>>>>>>> on an unsupported version of Windows. Of course, this should be documented.
>>>>>>>>>> We also need to make sure we know *exactly* what versions it does and does
>>>>>>>>>> not work on.
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>> Dave Page
>>>>>>>>>> Blog: https://pgsnake.blogspot.com
>>>>>>>>>> Twitter: @pgsnake
>>>>>>>>>>
>>>>>>>>>> EDB: https://www.enterprisedb.com
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> Fahar Abbas
>>>>>>>>> EnterpriseDB Corporation
>>>>>>>>> Phone Office: +92-51-835-8874
>>>>>>>>> Phone Direct: +92-51-8466803
>>>>>>>>> Mobile: +92-333-5409707
>>>>>>>>> Skype ID: *live:fahar.abbas*
>>>>>>>>> Website: www.enterprisedb.com
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> Dave Page
>>>>>>>> Blog: https://pgsnake.blogspot.com
>>>>>>>> Twitter: @pgsnake
>>>>>>>>
>>>>>>>> EDB: https://www.enterprisedb.com
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Fahar Abbas
>>>>>>> EnterpriseDB Corporation
>>>>>>> Phone Office: +92-51-835-8874
>>>>>>> Phone Direct: +92-51-8466803
>>>>>>> Mobile: +92-333-5409707
>>>>>>> Skype ID: *live:fahar.abbas*
>>>>>>> Website: www.enterprisedb.com
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Dave Page
>>>>>> Blog: https://pgsnake.blogspot.com
>>>>>> Twitter: @pgsnake
>>>>>>
>>>>>> EDB: https://www.enterprisedb.com
>>>>>>
>>>>>>
>>>>>
>>>>> --
>>>>> Fahar Abbas
>>>>> EnterpriseDB Corporation
>>>>> Phone Office: +92-51-835-8874
>>>>> Phone Direct: +92-51-8466803
>>>>> Mobile: +92-333-5409707
>>>>> Skype ID: *live:fahar.abbas*
>>>>> Website: www.enterprisedb.com
>>>>>
>>>>
>>>>
>>>> --
>>>> Dave Page
>>>> Blog: https://pgsnake.blogspot.com
>>>> Twitter: @pgsnake
>>>>
>>>> EDB: https://www.enterprisedb.com
>>>>
>>>>
>>>
>>> --
>>> Fahar Abbas
>>> EnterpriseDB Corporation
>>> Phone Office: +92-51-835-8874
>>> Phone Direct: +92-51-8466803
>>> Mobile: +92-333-5409707
>>> Skype ID: *live:fahar.abbas*
>>> Website: www.enterprisedb.com
>>>
>>
>>
>> --
>> Dave Page
>> Blog: https://pgsnake.blogspot.com
>> Twitter: @pgsnake
>>
>> EDB: https://www.enterprisedb.com
>>
>>


Attachments:

  [image/png] image.png (42.2K, 3-image.png)
  download | view image

  [image/png] image.png (26.6K, 4-image.png)
  download | view image

  [application/octet-stream] RM_2341_v8.patch (7.0K, 5-RM_2341_v8.patch)
  download | inline diff:
diff --git a/docs/en_US/psql_tool.rst b/docs/en_US/psql_tool.rst
index 94692586..d8773214 100644
--- a/docs/en_US/psql_tool.rst
+++ b/docs/en_US/psql_tool.rst
@@ -10,6 +10,10 @@ PSQL tool allows user to connect to PostgreSQL/EDB Advanced server using psql te
 
 * PSQL will connect to the current connected database from browser tree.
 
+* PSQL utility does support execution of OS meta commands by using "\\!". Due to security concerns we have disabled the execution of such commands in pgAdmin PSQL tool. To enable OS meta commands set ALLOW_PSQL_SHELL_COMMANDS = True in configuration.
+
+* For Windows platform this feature is available on Windows 10 (1809 version and onwards).
+
 .. image:: images/psql_tool.png
     :alt: PSQL tool window
     :align: center
diff --git a/web/pgadmin/__init__.py b/web/pgadmin/__init__.py
index 2042ada8..41a7e328 100644
--- a/web/pgadmin/__init__.py
+++ b/web/pgadmin/__init__.py
@@ -60,7 +60,7 @@ winreg = None
 if os.name == 'nt':
     import winreg
 
-socketio = SocketIO(manage_session=False, async_mode='eventlet',
+socketio = SocketIO(manage_session=False, async_mode='threading',
                     logger=False, engineio_logger=False, debug=False,
                     ping_interval=25, ping_timeout=120)
 
diff --git a/web/pgadmin/browser/__init__.py b/web/pgadmin/browser/__init__.py
index 6e9fb629..fa7aa9e5 100644
--- a/web/pgadmin/browser/__init__.py
+++ b/web/pgadmin/browser/__init__.py
@@ -855,7 +855,8 @@ def utils():
             support_ssh_tunnel=config.SUPPORT_SSH_TUNNEL,
             logout_url=_get_logout_url(),
             platform=sys.platform,
-            qt_default_placeholder=QT_DEFAULT_PLACEHOLDER
+            qt_default_placeholder=QT_DEFAULT_PLACEHOLDER,
+            enable_psql=config.ENABLE_PSQL
         ),
         200, {'Content-Type': MIMETYPE_APP_JS})
 
diff --git a/web/pgadmin/browser/register_browser_preferences.py b/web/pgadmin/browser/register_browser_preferences.py
index cfe279b4..c2c16ad8 100644
--- a/web/pgadmin/browser/register_browser_preferences.py
+++ b/web/pgadmin/browser/register_browser_preferences.py
@@ -505,39 +505,39 @@ def register_browser_preferences(self):
             ' revert back to the default title with placeholders.'
         )
     )
+    if config.ENABLE_PSQL:
+        self.open_in_new_tab = self.preference.register(
+            'tab_settings', 'new_browser_tab_open',
+            gettext("Open in new browser tab"), 'select2', None,
+            category_label=PREF_LABEL_OPTIONS,
+            options=[{'label': gettext('Query Tool'), 'value': 'qt'},
+                     {'label': gettext('Debugger'), 'value': 'debugger'},
+                     {'label': gettext('Schema Diff'), 'value': 'schema_diff'},
+                     {'label': gettext('ERD Tool'), 'value': 'erd_tool'},
+                     {'label': gettext('PSQL Tool'), 'value': 'psql_tool'}],
+            help_str=gettext(
+                'Select Query Tool, Debugger, Schema Diff, ERD Tool '
+                'or PSQL Tool from the drop-down to set '
+                'open in new browser tab for that particular module.'
+            ),
+            select2={
+                'multiple': True, 'allowClear': False,
+                'tags': True, 'first_empty': False,
+                'selectOnClose': False, 'emptyOptions': True,
+                'tokenSeparators': [','],
+                'placeholder': gettext('Select open new tab...')
+            }
+        )
 
-    self.open_in_new_tab = self.preference.register(
-        'tab_settings', 'new_browser_tab_open',
-        gettext("Open in new browser tab"), 'select2', None,
-        category_label=PREF_LABEL_OPTIONS,
-        options=[{'label': gettext('Query Tool'), 'value': 'qt'},
-                 {'label': gettext('Debugger'), 'value': 'debugger'},
-                 {'label': gettext('Schema Diff'), 'value': 'schema_diff'},
-                 {'label': gettext('ERD Tool'), 'value': 'erd_tool'},
-                 {'label': gettext('PSQL Tool'), 'value': 'psql_tool'}],
-        help_str=gettext(
-            'Select Query Tool, Debugger, Schema Diff, ERD Tool '
-            'or PSQL Tool from the drop-down to set '
-            'open in new browser tab for that particular module.'
-        ),
-        select2={
-            'multiple': True, 'allowClear': False,
-            'tags': True, 'first_empty': False,
-            'selectOnClose': False, 'emptyOptions': True,
-            'tokenSeparators': [','],
-            'placeholder': gettext('Select open new tab...')
-        }
-    )
-
-    self.psql_tab_title = self.preference.register(
-        'tab_settings', 'psql_tab_title_placeholder',
-        gettext("PSQL tool tab title"),
-        'text', '%DATABASE%/%USERNAME%@%SERVER%',
-        category_label=PREF_LABEL_DISPLAY,
-        help_str=gettext(
-            'Supported placeholders are %DATABASE%, %USERNAME%, '
-            'and %SERVER%. Users can provide any string with or without'
-            ' placeholders of their choice. The blank title will be revert'
-            ' back to the default title with placeholders.'
+        self.psql_tab_title = self.preference.register(
+            'tab_settings', 'psql_tab_title_placeholder',
+            gettext("PSQL tool tab title"),
+            'text', '%DATABASE%/%USERNAME%@%SERVER%',
+            category_label=PREF_LABEL_DISPLAY,
+            help_str=gettext(
+                'Supported placeholders are %DATABASE%, %USERNAME%, '
+                'and %SERVER%. Users can provide any string with or without'
+                ' placeholders of their choice. The blank title will be revert'
+                ' back to the default title with placeholders.'
+            )
         )
-    )
diff --git a/web/pgadmin/browser/templates/browser/js/utils.js b/web/pgadmin/browser/templates/browser/js/utils.js
index 17268a4e..e38bf1b4 100644
--- a/web/pgadmin/browser/templates/browser/js/utils.js
+++ b/web/pgadmin/browser/templates/browser/js/utils.js
@@ -53,7 +53,7 @@ define('pgadmin.browser.utils',
   pgAdmin['override_user_inactivity_timeout'] = '{{ current_app.config.get('OVERRIDE_USER_INACTIVITY_TIMEOUT') }}' == 'True';
 
   /* GET PSQL Tool related config */
-  pgAdmin['enable_psql'] =  '{{ current_app.config.get('ENABLE_PSQL') }}' == 'True';
+  pgAdmin['enable_psql'] =  '{{enable_psql}}' == 'True';
   pgAdmin['allow_psql_shell_commands'] =  '{{ current_app.config.get('ALLOW_PSQL_SHELL_COMMANDS') }}'  == 'True';
   pgAdmin['platform'] =  '{{platform}}';
   pgAdmin['qt_default_placeholder'] = '{{qt_default_placeholder}}'
diff --git a/web/pgadmin/tools/psql/__init__.py b/web/pgadmin/tools/psql/__init__.py
index f62e0743..cb10d5db 100644
--- a/web/pgadmin/tools/psql/__init__.py
+++ b/web/pgadmin/tools/psql/__init__.py
@@ -20,7 +20,12 @@ from ... import socketio as sio
 from pgadmin.utils import get_complete_file_path
 
 if _platform == 'win32':
-    from winpty import PtyProcess
+    # Check Windows platform support for WinPty api, Disable psql
+    # if not supporting
+    try:
+        from winpty import PtyProcess
+    except ImportError as error:
+        config.ENABLE_PSQL = False
 else:
     import fcntl
     import termios


view thread (54+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected]
  Subject: Re: [pgAdmin][RM-2341]: Add menu option for starting PSQL
  In-Reply-To: <CAOBg0AP1NLfkiF30R6zddrficHRkOsfa3127sGTChJrigWgYEA@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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