How do I import modules for Extension Tool in Jython
Hello,
I'm trying to import a module in Jython but I'm getting some errors.
I first go to Windows > Preferences > PyDev > Interpreters > Jython Interpreters and add the jython.jar found in the installation URL: C:\Program Files\Parasoft\Test\9.10 for SOAtest & Virtualize\plugins\com.parasoft.xtest.scripting.eclipse.core_9.7.0.20161116\jython. I then add a Test and try importing any of the modules there and then get the following message:
Traceback (most recent call last):, File "", line 1, in , ImportError: No module named re,
I then set system properties with the jython.jar and jython/Lib paths
and get the following message:
Traceback (most recent call last):, File "", line 1, in , File "pyclasspath/re.py", line 7, in , File "pyclasspath/sre.py", line 17, in , File "pyclasspath/sre_compile.py", line 15, in , AssertionError: SRE module mismatch,
After, I installed Jython 2.7 and put the jython home and jython path on Parasoft > Preferences > Scripting and still get the same AssertionError message.
What can I do to import these modules successfully?
Thank you
Comments
-
What can I do to import these modules successfully?
First, please undo the settings that you previously changed (click Restore Defaults on both pages). Next, follow the steps described here: Configuring Jython Preferences
Typically, a user would download and install their own Jython 2.5.2 and then set "Jython Home" field to the path to that Jython installation. By doing this, SOAtest's internal Jython will automatically pick up an use any modules belonging to that other Jython installation's "Lib" directory. Additionally, if you have your own custom modules (.py files) in some other folder, then you can add that custom module folder in that "Jython Path" field. Please note that Jython version must be 2.5.2 and that you must also restart SOAtest after changing "Jython Home" or "Jython Path" fields.
1 -
I switched to Jython 2.5.2, followed the documentation, and it works. You're the best, thank you.
0 -
Sorry I got Jython 2.5.2 working, but is there a way to make Jython 2.7 work with SOAtest? As noted in my initial post I got a module mismatch error. Are there some files or folders I would need to remove from the SOAtest installation in order to avoid this error? After googling the error it seemed to relate with a conflict in installed Jython versions.
Thank you again in advance.
0 -
Unfortunately there is currently no way to make Jython 2.7 work with SOAtest. We have an internal feature request to support Jython 2.7, but we haven't implemented it yet due to a couple of known bugs in Jython 2.7 that make it difficult to integrate into SOAtest. Once Jython resolves those issues we hope to update Jython within SOAtest.
0 -
Thank you very much for the response.
0 -
Also see my previous answer to this same question which has a little more detail:
Changing python version in Parasoft SoaTest0 -
Hello,
I've already added the jython path in the preference, but still .py file is not working in the tool. Also, I'm not able to get the method name in the extension tool drop down. Can anyone please help me with this issue?Thanks!
0 -
I've added jython as per below screenshot. Please let me know if this is the right way to update jython path
0 -
@Benz27, can you look at my previous answers? It looks like you are pointing your "Jython Home" to a Jython 2.7.2. I wrote why this won't work. You must point to a Jython 2.5.2 instead.
0 -
Still I'm getting the same error. I installed jython 2.5.2 and updated the path
0 -
What is the complete error message?
0 -
Traceback (most recent call last):, File "", line 4, in , ImportError: No module named PythonLibrary,
0 -
I'm trying to call python function using extension tool in Parasoft but it seems like something is missing.
0 -
Is there any way you can show us the contents of your script?
0 -
What is the "Functions" module? I can't seem to find it anywhere.
0