Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
John-Holt-Tessella opened this issue May 15, 2019 · 1 comment
Open

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

John-Holt-Tessella opened this issue May 15, 2019 · 1 comment

Comments

@John-Holt-Tessella
Copy link

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); 
@kasemir
Copy link
Contributor

kasemir commented May 15, 2019

Not sure what you mean by "loaded via a pure path".
Still, if you think your line 62 suggestion fixed it, try that and create a pull request.
I'm currently unable to build CSS with the ongoing JDK 8->9+ move, so cannot test.

@berryma4 berryma4 added this to the 4.6.0 - testing (master) milestone Aug 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants