Post Reply 
Pass parameter to Python?
09-07-2023, 11:22 AM (This post was last modified: 09-07-2023 02:02 PM by toml_12953.)
Post: #1
Pass parameter to Python?
How can I pass a parameter or parameters to a Python program called in an HPPL shell? The below doesn't work.

Code:
#PYTHON myfunc(x)
print(x);
#END

EXPORT PassParm(y)
BEGIN
myfunc(y);
END;

Tom L
Cui bono?
Find all posts by this user
Quote this message in a reply
09-07-2023, 11:55 AM
Post: #2
RE: Pass parameter to Python?
Try this:

Code:
#PYTHON myfunc
from sys import argv
print(argv[0]);
#END

EXPORT PassParm(y)
BEGIN
 PYTHON(myfunc,y);
END;

-road
Find all posts by this user
Quote this message in a reply
09-08-2023, 03:05 AM
Post: #3
RE: Pass parameter to Python?
(09-07-2023 11:55 AM)roadrunner Wrote:  Try this:

Code:
#PYTHON myfunc
from sys import argv
print(argv[0]);
#END

EXPORT PassParm(y)
BEGIN
 PYTHON(myfunc,y);
END;

-road

Thanks! That works fine. I ended up using this


Code:
#PYTHON myfunc(a)
from sys import argv
print(argv[0]);
#END

EXPORT PassParm(y)
BEGIN
  myfunc(y);
END;

Tom L
Cui bono?
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)