VanDyke Software Forums

VanDyke Software Forums (https://forums.vandyke.com/index.php)
-   Scripting (https://forums.vandyke.com/forumdisplay.php?f=14)
-   -   trouble importing external modules (SCRT 9.0) (https://forums.vandyke.com/showthread.php?t=14397)

garrettwilliams 01-19-2021 08:59 AM

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

bgagnon 01-19-2021 09:43 AM

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?

garrettwilliams 01-19-2021 02:44 PM

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.

bgagnon 01-20-2021 07:29 AM

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?

garrettwilliams 01-21-2021 08:03 AM

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.

bgagnon 01-21-2021 08:46 AM

Hi garrettwilliams,

Thanks for posting the resolution. I am glad to hear you got it working. :)


All times are GMT -6. The time now is 11:51 AM.