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-14-2021, 08:55 PM
nhandh09 nhandh09 is offline
Registered User
 
Join Date: Jan 2021
Posts: 6
Exclamation How to install site packages into CRT pyhon path

Hi all,

I'm using CRT Version 8.7.3 (x64 build 2279), python 3.8.5. I'm facing trouble when trying import other libraries in to CRT, such as: xlwings, openpyxl, .. to interact with excel files.

I did try to copy library manually into CRT path:

"C:\Program Files\VanDyke Software\Clients"


"C:\Program Files\VanDyke Software\Clients\vpython27.zip\site-packages"


But it's not work, some error like: module not file, invalid syntax


Could CRT team and friends on forum please help me out! Many thanks!

Nhan Dinh
Reply With Quote
  #2  
Old 01-15-2021, 09:03 AM
cboyack cboyack is offline
VanDyke Technical Support
 
Join Date: Apr 2020
Location: Albuquerque, NM
Posts: 86
Hi nhandh09,

It looks like you're trying to customize the built-in Python 2.7 environment that ships with SecureCRT v8.7.3. Sadly, the embedded Python environment in SecureCRT v8.7.3 for Windows is not customizable.

You can see this forum thread for further details.

If you desire to use Python 3 (and external modules) within SecureCRT for Windows, it is only possible in SecureCRT v9.0, which is currently undergoing beta cycles.

This post has information on how to use Python 3 with SecureCRT v9.0 for Windows.
__________________
Thanks,
--Cameron

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #3  
Old 01-16-2021, 09:27 AM
nhandh09 nhandh09 is offline
Registered User
 
Join Date: Jan 2021
Posts: 6
Smile

Many thanks for your prompt reply Cameron!

I'm going to stay with my current setup, and stay with python csv build in library on crt. I found this script example on forum https://www.vandyke.com/support/secu...o_excel.py.txt
, but it still complicated for me (I'm not pro at python). Could you have some simple script that use csv library?

I just need code that read the file (.csv file) and put some infomation back on the file and save it, close it.

I did find link for document about csv library, but have IOerror when I ran example code on CRT and I can not solve it https://docs.python.org/2.7/library/csv.html

Again, lot of thanks for your help!!!
Reply With Quote
  #4  
Old 01-16-2021, 10:24 AM
nhandh09 nhandh09 is offline
Registered User
 
Join Date: Jan 2021
Posts: 6
Unhappy

And is there anyway for CRT 8.7 scripting interact with .xlsx (excel files) team?

Many thanks team!
Reply With Quote
  #5  
Old 01-18-2021, 09:20 AM
cboyack cboyack is offline
VanDyke Technical Support
 
Join Date: Apr 2020
Location: Albuquerque, NM
Posts: 86
Hi again nhandh09,

We don't provide custom scripting solutions for customers. What we have made available are a number of scripting examples that our customers can use as a starting point in their own scripting solutions. Some of the scripts may work exactly as needed right out of the box, but many of them require tweaking for exact user environments.

Additionally, if the example which you shared is too complicated, that's perhaps the most simple .csv-associated script that is available...

Here are the scripts from that forum sticky that we have made available that show interactions with .csv files:
And, regarding your question regarding .xlsx files, yes, we do have a few that are available on the scripting sticky, but none of them are .py files, as vbscript interfaces much better with Excel than python does. None of them is particularly simple, either, FYI.

If you desire help dealing with the IOError, would you please share your script and the exact error that you're getting? If there's any sensitive data, please send that information in an email to support@vandyke.com with "Attn Cameron: Forum Thread 14393" in the subject line.
__________________
Thanks,
--Cameron

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #6  
Old 01-25-2021, 10:29 PM
nhandh09 nhandh09 is offline
Registered User
 
Join Date: Jan 2021
Posts: 6
Thanks Cameron!

I'm thinking about solution that I do a VBS module for read/write .xlsx files.

Dose Python 2. included with CRT 8.7 support calling other VBS script?
Reply With Quote
  #7  
Old 01-26-2021, 09:26 AM
cboyack cboyack is offline
VanDyke Technical Support
 
Join Date: Apr 2020
Location: Albuquerque, NM
Posts: 86
Hello again nhandh09,

Sorry but no, SecureCRT doesn't support calling other VBScripts (or any other scripts). Only one script can be running per tab at any given time in SecureCRT.
__________________
Thanks,
--Cameron

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #8  
Old 01-26-2021, 10:01 AM
nhandh09 nhandh09 is offline
Registered User
 
Join Date: Jan 2021
Posts: 6
Quote:
Originally Posted by cboyack View Post
Hello again nhandh09,

Sorry but no, SecureCRT doesn't support calling other VBScripts (or any other scripts). Only one script can be running per tab at any given time in SecureCRT.
Thanks a lot Cameron, but I'm wonder if it possible with CRT 9.0? I read on forum that with CRT 9.0 and Python 3.x, we can use external module (from thread below):



And with Python, we can import external library or ourself module (.py file) on the lines of code/script. That mean we can call another function, on another module, is it right Cameron?
Reply With Quote
  #9  
Old 01-26-2021, 10:44 AM
cboyack cboyack is offline
VanDyke Technical Support
 
Join Date: Apr 2020
Location: Albuquerque, NM
Posts: 86
Hi nhandh09,

You asked earlier about using a VBS module. This is different from accessing another python module, and it's also different from calling other VBS script, to use your wording.

SecureCRT v9.0 with Python 3 in use is capable of utilizing external python modules and libraries.

If you're asking about using an external python module that might exist specifically for interfacing with excel spreadsheets, that's something that may be possible, but we have no experience to share in that regard, and such would not be related to VBScript in any sense that I can see.
__________________
Thanks,
--Cameron

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #10  
Old 01-27-2021, 07:00 AM
nhandh09 nhandh09 is offline
Registered User
 
Join Date: Jan 2021
Posts: 6
Highly appreciated Cameron, and CRT team for the support. I understood my situation. And we will close the topic right here!
Reply With Quote
Reply


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 09:26 PM.