How do I import modules for Extension Tool in Jython

amurphy147amurphy147 Posts: 6

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

  • benken_parasoftbenken_parasoft Posts: 699 ✭✭✭
    edited March 11

    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.

  • amurphy147amurphy147 Posts: 6

    I switched to Jython 2.5.2, followed the documentation, and it works. You're the best, thank you.

  • amurphy147amurphy147 Posts: 6

    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.

  • jakubiakjakubiak Posts: 517 admin

    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.

  • amurphy147amurphy147 Posts: 6

    Thank you very much for the response.

  • benken_parasoftbenken_parasoft Posts: 699 ✭✭✭
    edited March 12

    Also see my previous answer to this same question which has a little more detail:
    Changing python version in Parasoft SoaTest

Sign In or Register to comment.