Wg Info from .txt Error 3.58b209011

Hello, I could have sworn this was working after update 3.58b209011 but maybe it quit when I opened KLWP to edit something. I use a formula to pull info from a local text file but it seems to be broken now no matter what I do. I've even moved the file to the specified kustom directory and it still returns ;

err: file '/storage/emulated/0/Documents/quotes.txt' cannot be read.

Or whichever variation of directory it's stored in.

If there is a new method of pulling data from local files, I'm sorry for wasting anyone's time. Would definitely love to know what it was so I could fix this. It's just a basic random quote generator.

Thank you very much for your time.

I’ve got exactly the same problem. I created a simple text file with quotes I wanted to have displayed in a widget and always get the error message
err: java.io.ioexception: unable to read file /storage/emulated/0/quotes.txt

Version 3.73b314510

Double checked on all used formula, there’s no error in there.

Would be nice if someone could help.

Did you try to use flows to access local files and then set a global with the text instead? With flows you can grant access to any folder and then read a file from it, that should be more stable than using direct file access that unfortunately its not working well with new storage API introduced in latest Android requirements.

Thank you, Frank. Is there any instruction how to do that? I have to admit that I’m a complete layman in this.

Sorry for the delay, so, let’s assume that:

  • your weather is a TXT file and you want to display it in a text box
  • the file is called foo.txt and its in the Documents folder

Then you need to:

  • Go to the “Flows” tab, add a new flow
  • Add a manual trigger
  • Add a Document action, in the document action select the folder and use a filter to match the name like this:
  • Add a formula action to read as text the file, formula should be like $wg(#last, txt)$, where #last in flows is the local var containing the last result, off course you can also use json or others here
  • Then add an action to set content to a global:

The flow should look like this:

You can now press “test flow” and see content stored:

In this case file content was “ciao”

When is this run? When you set a manual trigger it will be triggered via touch (you need to associate a touch action), you can also trigger it on a time basis or formula basis. Right now triggering a flow when a file changes is not supported

Hope it helps.