0

I am in the process of migrating my scripts from python SL4A to QPython (can't get SL4A to work on android lollipop).

I can't save a file to the disk
So I am using:

with open("foo.txt" ,"a") as f:
    f.write(theInfo)

And I get

IOError: [Errno 30] Read-only file system: 'foo.txt'

I know what the error means, I just don't know where to save the file...

Thanks for the help,
marbs

user850498
  • 717
  • 1
  • 9
  • 22

2 Answers2

3

The error is saying that you are in a protected part of a file system. That means you may want to save the file in an un-protected part. So, you may want to replace the "foo.txt" part with "/mnt/sdcard/foo.txt" or "/storage/sdcard0/foo.txt" or whatever is the path of internal storage on your phone. Do you understand what am I saying?

0

Qpython has disabled writing to files, my recommendation is to find a different script interpreter like the inpython app on android, or the python module in Termux and run it from there.

  • I understand file writing has been possible since qpython 1.0 (and certainly is now with a correctly specified path), so this comment is no longer justified. – Elroch Jul 11 '18 at 14:47