Post Reply 
is there any way to get list of files in application?
02-26-2024, 01:20 PM
Post: #1
is there any way to get list of files in application?
I have a Python program where I want the user to be able to pick a file from the Python application files but I can't see any way of getting the list of files either natively on the Prime or via Python.

Am I missing something or is this currently not possible?

I can open files that I've added to Python without a problem but I want a list of them so I can display and let the user choose one (no os.listdir() etc).

Thanks

Calculator Clique on YouTube
Visit this user's website Find all posts by this user
Quote this message in a reply
02-26-2024, 01:26 PM
Post: #2
RE: is there any way to get list of files in application?
(02-26-2024 01:20 PM)dmh Wrote:  I have a Python program where I want the user to be able to pick a file from the Python application files but I can't see any way of getting the list of files either natively on the Prime or via Python.

Am I missing something or is this currently not possible?

I can open files that I've added to Python without a problem but I want a list of them so I can display and let the user choose one (no os.listdir() etc).

Try this:
Code:
from hpprime import eval as ppleval
files = ppleval('AFiles')

The list with file names will be stored in the variable "files".
Find all posts by this user
Quote this message in a reply
02-27-2024, 12:59 AM
Post: #3
RE: is there any way to get list of files in application?
Perfect - thank you!!!

I actually found some samples using AFiles but they were all reading and writing files and I didn't see this exact example.


(02-26-2024 01:26 PM)komame Wrote:  
(02-26-2024 01:20 PM)dmh Wrote:  I have a Python program where I want the user to be able to pick a file from the Python application files but I can't see any way of getting the list of files either natively on the Prime or via Python.

Am I missing something or is this currently not possible?

I can open files that I've added to Python without a problem but I want a list of them so I can display and let the user choose one (no os.listdir() etc).

Try this:
Code:
from hpprime import eval as ppleval
files = ppleval('AFiles')

The list with file names will be stored in the variable "files".

Calculator Clique on YouTube
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




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