Post Reply 
Python, separate file handling
04-24-2021, 10:34 PM (This post was last modified: 04-24-2021 10:35 PM by Guenter Schink.)
Post: #9
RE: Python, separate file handling
(04-24-2021 11:14 AM)jonmoore Wrote:  I don't believe things are functioning in an optimal manner right now. As the Python functionality improves over time, you should be able to have 10's even 100's of .py files within the Python apps content folder and call them up at will. Some will be standalone programs whilst others could be bespoke function libraries that use the 'import from xxxx ****' Python function library workflow.

As I'm digging in more and more, I'm definitely missing a coherent description of the intended architecture. So far it seems to me that:

The PPL environment is the place to create and store your Python executives. Whereas the files within the Python app are the place to define your independent modules.

Example:
Have a system wide module with a function to raise a number to a power of itself in the Python app: File name "test2.py"
Code:
def expself(x):
  return x**x

Create a short PPL program that actually provides a python program and uses the module test2.py
Code:
#PYTHON name
import sys
import test2
a=int(sys.argv[0])
print("number returned by module test2 ", test2.expself(a))
#end

Export test1(a)
Begin
  PYTHON(name, a);
End;

Editing is done with a lot of copy and paste.

Unfortunately the G2 as well as the virtual calculator always reboot when chnaging from <HOME> to the Python app. It's not a big deal because almost nothing is lost. But annoying still.

And the statement of Tim in the python.odt
Quote:If you create a python file in your program (using the more/Files/New program function), you can call this script by doing PYTHON(“_name”, parameters) where name is the name of your python file. The “_” here serves as the marker for the system to know how to interpret the input.
doesn't work for me.

Günter
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Python, separate file handling - Dirk.nl - 04-23-2021, 11:20 AM
RE: Python, separate file handling - Guenter Schink - 04-24-2021 10:34 PM



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