Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 06-22-2020, 10:33 AM
pjano1 pjano1 is offline
Registered User
 
Join Date: Mar 2020
Posts: 6
Using YAML in Python with SecureCRT

I'm trying to extract and parse a YAML config file on a Windows system, but I'm unable to successfully import yaml from within a SecureCRT python script. The weird thing is, I'm able to do this no problem on a Linux system. I realize part of this might be because YAML isn't included with SecureCRT's python, but what I don't understand is why it works in Linux but not Windows. Any suggestions?

Last edited by pjano1; 06-22-2020 at 11:29 AM.
Reply With Quote
  #2  
Old 06-22-2020, 11:47 AM
jdev's Avatar
jdev jdev is offline
VanDyke Technical Support
 
Join Date: Nov 2003
Location: Albuquerque, NM
Posts: 998
Hello "pjano1",

Because python is not natively available on a stock Windows machine, SecureCRT for Windows provides a limited Python environment; it's not a comprehensive Python distribution.

Additionally, external third-party Python modules cannot be imported into this limited Python environment within SecureCRT on Windows.

I've added a feature request for the ability to include the yaml library/module you want in SecureCRT's limited Python environment.

I've also added a feature request for the ability to use a completely separate Python environment, rather than the limited Python environment that is currently shipping with SecureCRT, in case you wanted to go with a third-party Python environment on your Windows machine.

I don't yet have any ETA for when or even if these might ever become available, but if either does we can post here for notification.
If you prefer direct email notification, send an email to support@vandyke.com with a subject of Please notify: Feature Requests - Forum Thread #14215.

--Jake
__________________
Jake Devenport
VanDyke Software
Technical Support
YouTube Channel: https://www.youtube.com/vandykesoftware
Email: support@vandyke.com
Web: https://www.vandyke.com/support
Reply With Quote
  #3  
Old 06-22-2020, 12:30 PM
pjano1 pjano1 is offline
Registered User
 
Join Date: Mar 2020
Posts: 6
Hi Jake,

Thanks for both of the feature requests.

For now I could probably switch to a format other than YAML that could still work with the limited Python environment. But, YAML is my preference so if either of those features become available in the future that would be huge.

To add on to my original question, I am able to work with YAML in SecureCRT for Linux. Is this because this version of SecureCRT has a more robust Python environment than Windows?
Reply With Quote
  #4  
Old 06-22-2020, 01:27 PM
jdev's Avatar
jdev jdev is offline
VanDyke Technical Support
 
Join Date: Nov 2003
Location: Albuquerque, NM
Posts: 998
Quote:
Originally Posted by pjano1 View Post
I am able to work with YAML in SecureCRT for Linux. Is this because this version of SecureCRT has a more robust Python environment than Windows?
If by "more robust", you mean "present with a stock install of the OS", you're spot on.

SecureCRT for mac/Linux environments uses the Python engine/environment that is natively installed and available on stock installs of supported operating systems.
  • SecureCRT for mac/Linux doesn't ship with (include as part of its installer) any python engine/environment on supported mac/Linux platforms because supported mac/Linux platforms are expected to already have a native python environment in place.

  • Conversely, python is not natively available on a stock Windows machine, so SecureCRT for Windows provides (as part of the SecureCRT installation) a limited Python environment -- one that is pre-compiled with the objective to facilitate SecureCRT automation, rather than one designed to provide a "robust" or complete Python environment for all possible Python activities. The Python environment that comes with SecureCRT for Windows is not user-customizable.
Therefore, as a matter of what's available natively vs. what SecureCRT for Windows includes with its installer, one could say that the Python environment available to SecureCRT on supported Linux/Mac operating systems is more expansive ("robust", perhaps?) than the python environment that is included with SecureCRT for Windows.

--Jake
__________________
Jake Devenport
VanDyke Software
Technical Support
YouTube Channel: https://www.youtube.com/vandykesoftware
Email: support@vandyke.com
Web: https://www.vandyke.com/support
Reply With Quote
Reply

Tags
python , python import


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 07:20 PM.