The ¡°subprocess.run¡± line is meant to run sometime as, well, a subprocess. This is attempting to run the 2nd script outside JMRI. It¡¯s not set up for that.
If your goal is to run a separate script file, you can use ¡°execfile(..)¡± to do that.
More generally, JMRI¡¯s scripting uses a Python derivative called Jython. The good news is that Jython works with underlying Java code well. The bad news is that it¡¯s Python 2.5, i.e. old, and doesn¡¯t have many of the nice Python packages that can do cool things.
There¡¯s been some limited work on using native Python3 for scripting, but that¡¯s really not ready for general use yet.
Bob
On Dec 10, 2023, at 11:27?PM, Toni Mury <toni@...> wrote:
Could someone please advise why the following python scripts work together in RPi Thonny, but not from within PanelPro.
The script for the initiating programme, testsend.py :
import subprocess
import sys
x=678
print(x)
subprocess.run(["python3","testreceive.py", str(x)])
and this is the script for the receiving programme, testreceive.py "
import serial
import sys
if len(sys.argv)>1:
y= int(sys.argv[1])
print(1+ y)
else:
print("no argument received")
Thank you in anticipation
Toni
¡ª
Bob Jacobsen
rgj1927@...