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 01-19-2017, 11:57 AM
asamue asamue is offline
Registered User
 
Join Date: Jan 2017
Posts: 2
Python netmiko

Hi
I'm trying to import netmiko module to secure crt 8.0.4 python 2,7 installation but I can't get it to work.
Can anyone explain how to do it with secure crt
I have no problem running netmiko in my normal python 2.7 installation but I want to use the the one that is built.
Reply With Quote
  #2  
Old 01-19-2017, 12:27 PM
jdev's Avatar
jdev jdev is offline
VanDyke Technical Support
 
Join Date: Nov 2003
Location: Albuquerque, NM
Posts: 920
SecureCRT's built-in python interpreter is a somewhat of a bare-bones python environment and does not support importing all possible modules that could exist.

My guess is the netmiko module you're trying to import depends on another module that is not part of SecureCRT's bare-bones python environment.

What does "can't get it to work" specifically look like for you?

For example, what specific error(s) are you seeing when your code attempts to import netmiko?

--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 01-20-2017, 12:01 AM
asamue asamue is offline
Registered User
 
Join Date: Jan 2017
Posts: 2
When you install Netmiko in a "stand alone" python installation, you do it with "python setup.py install" where setup.py is netmikos setup file.
I can't find a way of doing this with secure crt ( and maybe you can't do it thaty way)
I have tried to copy the modules that I need but I can't get it to work even though I have modified the sys.path to point to the correct module.

Is there a way of having secure crt to call an external python installation instead of using the one built in?
Reply With Quote
  #4  
Old 01-20-2017, 11:29 AM
jdev's Avatar
jdev jdev is offline
VanDyke Technical Support
 
Join Date: Nov 2003
Location: Albuquerque, NM
Posts: 920
Quote:
Originally Posted by asamue View Post
When you install Netmiko in a "stand alone" python installation, you do it with "python setup.py install" where setup.py is netmikos setup file. I can't find a way of doing this with secure crt (and maybe you can't do it that way)
You're absolutely right. You cannot import a module like this into SecureCRT's built-in python environment.

Quote:
Is there a way of having secure crt to call an external python installation instead of using the one built in?
If you're using a version of SecureCRT 8.0.1 and earlier, you can use an external python installation by renaming the python27.dll and python27.zip files (found in SecureCRT's program files location) to something like python27-do_not_use.dll and python27_do_not_use.zip.

However, as of SecureCRT version 8.0.2 and later, this is not possible because a change was made in SecureCRT to only load its own built-in python engine.

I've added a feature request on your behalf to allow SecureCRT to load/use an external python installation. Should this ever be possible in the future, we'll be sure to post here and let you know.

--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
  #5  
Old 07-16-2019, 10:48 AM
kevin.p.ross kevin.p.ross is offline
Registered User
 
Join Date: Jul 2019
Posts: 2
Question Other modules available

I'm attempting to script a callout to return OUI manufacturer info (this is in a Windows installation). The example script for GoogleSelectedText does work and launches a browser window with the answer using the webrowser module. I'd like to keep it all within SecureCRT though, and tried using urllib.request, but get the error "The specified module could not be found.".

As a new and exploring python script writer here, I was wondering if there is an available list of the modules included in the bare-bones python included in SecureCRT.

Also, any recommendation for making a similar call within the available library?

Thanks,
Kevin
Reply With Quote
  #6  
Old 07-16-2019, 01:16 PM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 3,940
Hi Kevin,

If you open (for viewing) the vpython27.zip file included in SecureCRT's installation directory, you will see the included modules. However, there won't likely be any modules/libraries that will provide network/TCP access; those are generally not available in the minimal Python environment that comes with SecureCRT. In addition, there may be libraries that are included with SecureCRT's Python environment that won't work because the _socket module is not present. (Support for that is a feature request and I've added this thread to that.)
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #7  
Old 07-16-2019, 04:06 PM
kevin.p.ross kevin.p.ross is offline
Registered User
 
Join Date: Jul 2019
Posts: 2
Thanks Brenda for the quick response. I'll check that out and stick with the webbrowser call for now, it gets me the info I'm looking for.
Reply With Quote
Reply

Tags
netmiko , python 2.7


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 01:58 AM.