Skip to content

Python scripting fails to import module in OPI path. #2594

Open
@John-Holt-Tessella

Description

@John-Holt-Tessella

I get the following error when loading an opi in BOY:

Traceback (most recent call last):
  File "<script>", line 7, in <module>
ImportError: No module named ChannelUtilities

The issue appears to be that the OPI directory is no longer being added to the sys path on the start of the OPI. If I add to my script

ConsoleUtil.writeError("Sys path {}".format(sys.path))

I get the following added in an older version compared to the current version:
C:\\Instrument\\Apps\\client_4.3\\Client_5.2.2\\plugins\\uk.ac.stfc.isis.ibex.opis_1.0.0.3\\resources\\HV\\Script

This has happened since we switched to using css studio with jython 2.7.1. I believe that the problem is at https://github.com/ControlSystemStudio/cs-studio/blame/master/applications/opibuilder/opibuilder-plugins/org.csstudio.opibuilder/src/org/csstudio/opibuilder/script/JythonScriptStore.java#L62.

which now uses the line:

jython/frozen-mirror@c7a3eba

I am not sure whether this is a problem in CSS Studio or Jython hence why I am adding this here.

I already have the patch #2541. This is not working because the OPI is loaded via a pure path. I think that the code on ln62 needed might be:

interp = new PythonInterpreter(new PySystemState(), state.getDict(), true); 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions