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-2021, 09:59 AM
garrettwilliams garrettwilliams is offline
Registered User
 
Join Date: Dec 2020
Posts: 11
trouble importing external modules (SCRT 9.0)

Hey all,

I've been using SecureCRT 9.0 and writing some pretty handy Python3 scripts for a few weeks now. The other day, I shared one of my scripts with a coworker, and they were unable to get it to work.

- They're using SecureCRT 9.0 on Windows 10

- They have Python 3.8.6 installed. This is the version that runs when they enter 'python' at the Windows command line.

- The package in question (PyQt) can be imported from the local Python shell.

- They're using the same scripts I am (Python3 tag used at top)

However, when they go to run the script in SecureCRT, they see a 'ModuleNotFound' error.


Any information on troubleshooting something like this would be greatly appreciated. I'm just quite stumped why, if secureCRT is using the local python interpreter, it doesn't see that module.

Thank you
Reply With Quote
  #2  
Old 01-19-2021, 10:43 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,548
Hi garrettwilliams,

Are you saying the same script works for you without issue?

If so, do you know of any significant differences in your environment compared to the colleague's?

Did your colleague follow the tips in this post?
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #3  
Old 01-19-2021, 03:44 PM
garrettwilliams garrettwilliams is offline
Registered User
 
Join Date: Dec 2020
Posts: 11
Hey Brenda,

Yes, that's correct. It works for me without issue. He also did follow the steps in that best practices post.

I'm not aware of any difference in our environment that would cause this. Outside of the PATH and PYTHONPATH variables, I'm not really sure where else to look.
Reply With Quote
  #4  
Old 01-20-2021, 08:29 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,548
Hi garrettwilliams,

My manager has suggested each of you (in your own environment) run the same simple script:

Code:
# $language = "Python3"
# $interface = "1.0"

import sys
import platform
strInfo = (
    "{}\n\nsys.version: {}\n\nsys.hexversion: {}\n\nplatform.python_version: {}\n\nImplementation: {}\n\nCompiler: {}\n\nBuild: {}\n\nPath: {}".format(
    sys.version_info,
    sys.version,
    sys.hexversion,
    platform.python_version(),
    platform.python_implementation(),
    platform.python_compiler(),
    platform.python_build(),
    sys.path
    ))
crt.Clipboard.Text = strInfo
crt.Dialog.MessageBox(strInfo)
What differences, if any, are displayed in the message box for each of you after running the script?
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #5  
Old 01-21-2021, 09:03 AM
garrettwilliams garrettwilliams is offline
Registered User
 
Join Date: Dec 2020
Posts: 11
Thanks for the response!

We actually got it sorted out. One of the modules I had built that we were importing was missing this:


Code:
# $language = "python3"
# $interface = "1.0"
Looks like he was running that module directly (I'm still unclear how he was doing this) and it was defaulting back to the Python2.7 interpreter.
Reply With Quote
  #6  
Old 01-21-2021, 09:46 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,548
Hi garrettwilliams,

Thanks for posting the resolution. I am glad to hear you got it working.
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
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 03:20 AM.