Post Reply 
Passing values from PPL to Python and vice versa - an alternative to AVars
12-05-2023, 06:16 PM (This post was last modified: 12-05-2023 06:48 PM by Guenter Schink.)
Post: #2
RE: Passing values from PPL to Python and vice versa - an alternative to AVars
Quote:Note that one of the known issues in Prime is the transfer of numerical values above three digits (more than 999) to Python as a parameter (via the argv[])

This "problem" is dependent on the digit grouping setting in the Home environment. To avoid it, at least partially, look at "HSeparator" which determines digit grouping.

In one of your examples you could add these three lines as indicated:
Code:

LOCAL pyresult;

#PYTHON pycode
from hpprime import eval as ppleval;
numbers = range(10)
ppleval('PYPPL.pyresult:=%s' %numbers);
#END

EXPORT PPL_PY() 
BEGIN
  LOCAL TSeparator:=HSeparator; // store digit grouping for later reset
  HSeparator:=3;                // set to no digit grouping at all.
  PYTHON(pycode);
  HSeparator:=TSeparator;       // reset digit grouping to what it was before
  RETURN pyresult;
END;
]
Now the 3 digits limit is gone.(haven't tested it though)
Günter

[Edit]
BTW: your program doesn't return the list. Seems that in:
"PYPPL.pyresult:=%s' %numbers" the PYPPL needs to be deleted and pyresult has to be declared as EXPORT instead of LOCAL. Or I did overlook something?
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Passing values from PPL to Python and vice versa - an alternative to AVars - Guenter Schink - 12-05-2023 06:16 PM



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