Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Advanced Scripting Environment (EASE) » Issue: python library is not imported when running script as EASE Script(Installed libraries in PYTHONPATH are not loaded when running a script as EASE Script)
Issue: python library is not imported when running script as EASE Script [message #1870704] Thu, 05 September 2024 15:36
Philippe Carvajal is currently offline Philippe CarvajalFriend
Messages: 1
Registered: September 2024
Junior Member
Some config info
ECLIPSE packaged as Capella 5.2.0 Application:
• Version: 5.2.0
• Build id: 202111301257
• PyDev Interpreter and libraries path config. as in "PyDev interpreter config.png" (Python v3.12.2)
• PyDev Project shows libraries are included (See PyDev_project_lib_inclusion.png)

The Problem:
I have the following PyDev Module "test.py":
print("importing openpyxl...")
import openpyxl

print(openpyxl.__file__)


Observation 1:
When running the script directly with the Python interpreter (See img: run_with_Python.png), I get the expected result. The console shows:
importing openpyxl...
C:\Users\XYZ\AppData\Roaming\Python\Python312\site-packages\openpyxl\__init__.py


Observation 2:
When running the script as an EASE Script (See img: run_as_EASE_script.png), the process seems to block. That is, in the console, the print() statement runs but then nothing happens. The console shows:

importing openpyxl...


I can leave the process running for 1-2 hrs and the console will still display the same text; no error messages.

Observation 3:
When running the import line (i.e., import openpyxl) on the Script Shell (with Py4J as the engine), I observe the same behavior. That said, when I kill the process (terminate button, red square, on the Console) I get the following:
1. In the Script Shell:
 py4j.Py4JException: Error while sending a command. 

2. In the Console I see:

py4j.Py4JException: Error while sending a command.
	at py4j.CallbackClient.sendCommand(CallbackClient.java:397)
	at py4j.CallbackClient.sendCommand(CallbackClient.java:356)
	at py4j.reflection.PythonProxyHandler.invoke(PythonProxyHandler.java:106)
	at com.sun.proxy.$Proxy25.executeInteractive(Unknown Source)
	at org.eclipse.ease.lang.python.py4j.internal.Py4jScriptEngine.internalExecute(Py4jScriptEngine.java:238)
	at org.eclipse.ease.lang.python.py4j.internal.Py4jScriptEngine.execute(Py4jScriptEngine.java:227)
	at org.eclipse.ease.AbstractScriptEngine.inject(AbstractScriptEngine.java:189)
	at org.eclipse.ease.AbstractScriptEngine.run(AbstractScriptEngine.java:242)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Caused by: py4j.Py4JNetworkException: Error while sending a command: c
p0
executeInteractive
simport openpyxl
e

	at py4j.ClientServerConnection.sendCommand(ClientServerConnection.java:253)
	at py4j.CallbackClient.sendCommand(CallbackClient.java:384)
	... 8 more
Caused by: java.net.SocketException: Connection reset
	at java.base/sun.nio.ch.NioSocketImpl.implRead(NioSocketImpl.java:323)
	at java.base/sun.nio.ch.NioSocketImpl.read(NioSocketImpl.java:350)
	at java.base/sun.nio.ch.NioSocketImpl$1.read(NioSocketImpl.java:803)
	at java.base/java.net.Socket$SocketInputStream.read(Socket.java:982)
	at java.base/sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:297)
	at java.base/sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:339)
	at java.base/sun.nio.cs.StreamDecoder.read(StreamDecoder.java:188)
	at java.base/java.io.InputStreamReader.read(InputStreamReader.java:181)
	at java.base/java.io.BufferedReader.fill(BufferedReader.java:161)
	at java.base/java.io.BufferedReader.readLine(BufferedReader.java:326)
	at java.base/java.io.BufferedReader.readLine(BufferedReader.java:392)
	at py4j.ClientServerConnection.readBlockingResponse(ClientServerConnection.java:313)
	at py4j.ClientServerConnection.sendCommand(ClientServerConnection.java:229)
	... 9 more


Question
The import statement was working just fine up until a few days ago when I ran a script as an EASE Script. I haven't changed anything on my end (can't say if something was pushed by my IT dept. without me noticing though). Any idea of where/how I can further investigate the issue?

Any thoughts would be greatly appretiated.

Thank you,

Phil
Previous Topic:Support of Scripting After migrating to Java 17
Goto Forum:
  


Current Time: Tue Oct 08 18:42:15 GMT 2024

Powered by FUDForum. Page generated in 0.04607 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top