Welcome to the VanDyke Software Forums

Join the discussion today!

Go Back   VanDyke Software Forums > Scripting


Closed Thread
Thread Tools Rate Thread Display Modes
Old 09-25-2020, 03:13 PM
jdev's Avatar
jdev jdev is offline
VanDyke Technical Support
Join Date: Nov 2003
Location: Albuquerque, NM
Posts: 1,099
Arrow How-To: Use Python 3.8 with SecureCRT v9.0 for Windows

New (beginning in version 9.0), SecureCRT on the Windows platform supports the use of a third party python v3.8 scripting engine.

Here are some tips to help you get started with using a Python 3.8 scripting engine in SecureCRT:
  1. Install SecureCRT 9.0 or newer.
    The ability to use a third party python non-windows-native and non-embedded python scripting engine is functionality that is new to SecureCRT starting with version 9.0.

  2. Install a python 3.8 scripting engine.
    The python 3.8 scripting engine from python.org is recommended: https://www.python.org/downloads/windows/.
    See the "Python installation notes" section below for details.

    • SecureCRT 9.0 supports the use of an external Python 3.8.x engine to automate SecureCRT functionality internal to SecureCRT (i.e. only when the script is run within SecureCRT via Script / Run... for example).
    • The external python engine must be 3.8.x -- no other external python 3 versions are supported in SecureCRT 9.0.
    • While using an external Python 3.8.x engine to run scripts within SecureCRT it may be possible to interface with Python libraries that are not native to that external Python 3.8.x environment; however, VanDyke Software does not test SecureCRT for or guarantee compatibility with any specific Python libraries.
    • Make sure you download the python v3.8 installer that matches the "bitness" of the SecureCRT that you have installed. For example, if you have the 64-bit version of SecureCRT installed, you must install the 64-bit version of python; if you have the 32-bit version of SecureCRT installed, you must install the 32-bit version of python.
    How do I know if the SecureCRT I am running is the 32-bit or 64-bit version?

    Look in the "About SecureCRT" window.
    • If the version seen there shows (x64 ...), then a 64-bit SecureCRT is running.
    • If the version seen doesn't show (x64 ...), then a 32-bit SecureCRT is running.

    How do I know if the python installer I downloaded is a 32-bit or 64-bit version?

    Typically the python.org installers will have "amd64" as part of the installer name if it's the 64-bit version. For example (64-bit): python-3.8.6-amd64.exe
    If you downloaded an installer that doesn't have "amd64" in the name, it's probably the 32-bit version. For example (32-bit): python-3.8.6.exe

    Python installation notes
    When installing python, you should enable the Add ... to PATH option so that SecureCRT will be able to find the python38.dll file for loading.
    If you fail to enable the Add Python 3.8 to PATH option, SecureCRT won't be able to find the Python 3 script engine.
    Then, when you try to run a Python 3 script, SecureCRT will have no other option but to report: "Unable to load the Python scripting engine."
    If you forget to have the python installer add itself to the PATH environment variable, you can do it manually within Windows for your user account.

    Can I use the Anaconda script engine instead?
    While it is recommended that you use the python.org script engine, if you want to use Anaconda as your script engine...
    • You may need to edit the PATH environment variable for your Windows user account to point to the Anaconda installation directory. For example:
    • You may also need to set the PYTHONPATH environment variable with a value which points to the Lib sub-directory in the Anaconda directory. For example:
    • You must be using SecureCRT Version or newer

  3. Use "Python3" as your scripting language in your SecureCRT script file header.
    For example:
    # $language = "Python3"
    # $interface = "1.0"
    import sys
    import platform
    The above code, when run in SecureCRT 9.0 after a successful python 3 engine installation, will generate a window like this:

  • If you want to continue using the python 2.7.x scripting engine that comes with SecureCRT, there's no need to change anything.
  • If you want to force the use of the python 3.8 scripting engine for all of your SecureCRT scripts, without having to specify the language as "Python3" in the script header, simply rename/remove the vPython* files located in SecureCRT's program files install folder (you'll have to close SecureCRT first).
Jake Devenport
VanDyke Software
Technical Support
YouTube Channel: https://www.youtube.com/vandykesoftware
Email: support@vandyke.com
Web: https://www.vandyke.com/support

Last edited by jdev; 08-18-2021 at 02:18 PM. Reason: Add extra emphasis to highlight need to enable the 'Add Python 3.8 to Path' option in the Python installer.
Closed Thread

how-to , python , python3 , scripting , securecrt

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -6. The time now is 04:34 PM.