2106 error. I can read a file but not save

I can read this file, but after editing it, I get an error when I try to save it. The error message is fast but says it's 2106 and can't write asset. I've written to SD ok. The message only appears on cel., not screen like most messages do.

No you haven't.
If you will hover your cursor over SaveFile method you will know that why it s showing error.

Yes, I have. I am neither a liar nor an idiot. I HAVE saved it to the SD and I have opened it from there with another program and verified the file's modified content. I did not paste here the code that works, but the one that does not.

Ok, maybe I am an idiot, for I cannot figure out your enigmatic solution. If I can open it with two slashes, why can I not save it?

assets folder is read only, you can not write in this folder.

1 Like

ahhhhh. That's a bummer. Thanks, man. Tried to find a place to change permissions. guess I'll save it somewhere else, then. Like the SD card since I already have done that before.

Hi Byron

Always use the Screen Error Block and display the result with a Notifier that requires the User to dismiss it - then you can see the exact error message.

Good idea. When it shows on PC and fone I can study it better - especially long messages. I had discovered the block but never thought of using it in this way.

Still banging my head on this file stuff. I've read everything I can find - some of it contradictory. I can't write to the // asset area and I can't write to the SD in most flavors of Android (mine is old enough). I don't want to write to the program data area as it isn't visible and I'd like to facilitate PC editing of .csv files. so why does this work and not this?

Have you asked for WRITE_EXTERNAL_STORAGE permission ?

blocks

Thanks for actually showing how to do that. I'd seen it before and thought I had to do something in Android. I'll try that, but have a question. Why would it work in the second example and not the third?

PS It works in companion mode just not compiled so I know the problem isn't with the list block or variable.

permission is already granted in companion app

I guessed that. Thought I should mention it.

But that still doesn't explain why second block works and third doesn't. I thought it might be because TR.csv already exists but multiple clicks still write. In other languages you have to specifically close a file after opening but I see no reference to closing files

Not spotted before, what is the WriteFile procedure you are using?

I'm not sure I understand the question. The 2 write procedures are in the picture in the first post.

image

Oh boy, Is there any way to delete this whole thread so the whole world doesn't know what an idiot I am. I realized the file was getting contaminated which means SOMEthing was able to write there. The error messages are a bit vague and I assumed ...

Anyway the problem was somewhere else. (an append block where I didn't correct the file name /)

"Ok everybody, as you were. Nothing to see here"

We got there....:slight_smile: