How to utilize an external installation type Python script

How to utilize an external installation type Python script

This guide will guide you through how to disable Xshell’s embedded python and instead utilize an external installation type Python script. Most users will have no issues using Xshell’s embedded Python (enabled by default), but this guide can be useful if you are running into errors and need to use an external Python script.

There are two main steps:

  1. Downloading and Configuring Python

  2. Configuring Xshell

Downloading and Configuring Python

  1. Download and Install Python 3.7

    1. To download Python, navigate to https://www.python.org/downloads/release/python-378/

    2. Locate and download the Windows executable installer.

       

    3. Install Python.
      Make sure to check the following option when installing:

       

       

  2. Download and Install Python for Windows Extensions

    1. To download the Python for Windows Extensions, navigate to the following page: https://github.com/mhammond/pywin32/releases

    2. Locate and download pywin32-228.win32-py3.7.exe.

       

    3. Install the downloaded file.
      When installing, make sure the directory paths are correctly set:

       

  3. Register Python for Windows Extensions

    1. Open CMD.

    2. Navigate to the following directory:
      > cd C:\Users\[“User name”]\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\win32comext\axscript\client

    3. Enter the following command:

      > python .\pyscript.py

    4. Verify that you see the following results:
      Requesting elevation and retrying...
      Registered: Python

  4. Designate the Python Directory in the Registry

    1. Open the Windows Registry Editor (regedit)

       

    2. Find the following registry key:
      \HKEY_CLASSES_ROOT\WOW6432Node\CLSID\{DF630910-1C1D-11d0-AE36-8C0F5E000000}\InprocServer32

      Note: Navigating to \HKEY_CLASSES_ROOT\WOW6432Node\CLSID\ and searching for pythoncom37.dll may be faster.

    3. Change the path value of pythoncom37.dll to the full directory path in which this file exists. This directory is where you installed Python.


      The default location is:
      C:\Users\[“User name”]\AppData\Local\Programs\Python\Python37-32\Pythoncom37.dll

       


Configuring Xshell

  1. Go into Xshell’s Options → Advanced and check the “Do not use Xshell’s embedded Python” option.

     

  2. Run your desired Python script.
    If you see the following error, then one or more of the settings above were not properly configured: