How to run a specific python program or file ?
|
09-13-2023, 06:52 AM
Post: #1
|
|||
|
|||
How to run a specific python program or file ?
Hello,
I'm stuck in this : If I enter shift + 1 to enter Program, I see "Python (App)", but touching it displays "Error loading file". And in the connexion kit pc app, I can't add python programs to "Programs", but just normal programs... There no Python (App) sub item. And in Programs, it doesn't recongnize .py python files to be python programs. If I do Apps -> Python, I can enter various .py files. The same in the connexion kit. I can edit opr add files with Symb. But when I do Num, it runs all python files ! Not just one I choose ! ... I want to be able to enter several python files and run the one I select, only one of my choice. Please do you know how to do it ? Thanks a lot. Kind regards, Vincent |
|||
09-13-2023, 01:27 PM
Post: #2
|
|||
|
|||
RE: How to run a specific python program or file ?
I have found 2 ways
for each python program you can save the python app with a new name and reset it and have a python app for each program, or in programs you can create a ppl program and use example #PYTHON QUAD import math print ("QUAD EQ AX^2+BX+C=0") A=float(input("A? ")) print(A) B=float(input("B? ")) print(B) C=float(input("C? ")) print(C) D=pow(B,2)-4*A*C EE=(-B+math.sqrt(D))/(2*A) FF=(-B-math.sqrt(D))/(2*A) print("ROOT 1="+str(EE)) print("ROOT 2="+str(FF)) #END EXPORT QUADpy() BEGIN PRINT(); PYTHON(QUAD); END; |
|||
09-13-2023, 01:39 PM
(This post was last modified: 02-15-2024 06:34 PM by komame.)
Post: #3
|
|||
|
|||
RE: How to run a specific python program or file ?
The best approach is to embed the Python script within a PPL program by labeling it as #PYTHON script_name. Then, you can refer to it from within PPL. The Python code area is not syntax-checked when using 'CHECK'; errors only appear after running the program.
Within a given Python script, you can create subroutines using 'def' and refer to them from the Python script itself. https://www.hpmuseum.org/forum/thread-17076.html https://www.hpmuseum.org/forum/thread-20468.html Best regards, Piotr |
|||
09-13-2023, 06:55 PM
Post: #4
|
|||
|
|||
RE: How to run a specific python program or file ?
Thanks a lot Doug et Piotr,
I'm ok with this. For me it's fine. I could use it and make some programs in python. I found some ohter methods too. But I wanted to be able to write python only programs and have a simple list of them, without using PPL. The problem is : the school asked my daughter to have a calculator with python. They said better with Numwrks or TI-84 python. I said my daughter that she could keep its hp prime and make python. But in comparation with Numworks and TI-84, I think it's too complex to make school programs on the hp prime. Maybe I'm wrong. But I saw it in the two other calculators and it seems it's easier on them. Maybe I'm wrong ? Thanks again, Regards, Vincent Maréchal |
|||
09-14-2023, 05:12 PM
(This post was last modified: 09-14-2023 05:12 PM by Dougggg.)
Post: #5
|
|||
|
|||
RE: How to run a specific python program or file ?
It is true, when the hp team was taken off the prime I don't think python was complete so I think there are lot of bugs and missing stuff, not sure what the future holds
|
|||
09-14-2023, 08:54 PM
Post: #6
|
|||
|
|||
RE: How to run a specific python program or file ?
Thanks Doug. Yes, HP should do better, just for business... Regards.
|
|||
09-15-2023, 12:06 AM
Post: #7
|
|||
|
|||
RE: How to run a specific python program or file ?
(09-13-2023 06:55 PM)vincentvije Wrote: Thanks a lot Doug et Piotr, The TI is far superior for pure Python. I have both and when I want to work with Python, I turn to the TI. It's easier to use and there are no glaring bugs. Tom L Cui bono? |
|||
09-16-2023, 12:35 PM
Post: #8
|
|||
|
|||
RE: How to run a specific python program or file ?
(09-15-2023 12:06 AM)toml_12953 Wrote:(09-13-2023 06:55 PM)vincentvije Wrote: Thanks a lot Doug et Piotr, Thanks Tom, it's all clear now. Sad HP doesn't make the step correctly. I like TI too, I worked on DSP for them some years ago. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)