androidpythonpython-3.xqpythonqpython3

QPython3 on Android read and write txt file


I am writing a little python textbased game on my android phone with qpython3. Now I want to store the highscores in a txt file but I can't find out how I can realize this. I know how I can do it on windows but it doesn't work on android.

Hope anyone has an idea.

Krowit


Solution

  • After testing on my device, it appears that QPython has blocked write permissions from the application. Here's a way of getting a version which allows for it*:

    1. Download SL4A, and install it. This is what launches the Python script.
    2. Download PY4A, this is the Android version of Python. You can download both 2.x and 3.x from here.
    3. You'll need a text editor now. DroidEdit is my personal favourite, and you can launch a script straight from the app.
    4. Then you can write in your code, save it, and run it!

    Of course, there's no real substitute for a real desktop, at least in my opinion, but this is (again, in my opinion) the best setup I've found so far.

    *I don't know where the files are saved, but you can read and write from them, wherever the saved file's directory may be.