Renpy, an exception when trying to build a build on Android (renpy.loader.transfn)

234 views Asked by At

Let's say there is a json file in ./resources called "string.json". Then the parsing of this file can be implemented as follows:

label start:
    $ import json
    $ f = open(renpy.loader.transfn("resources/string.json"))
    $ text = json.load(f)

On a PC and on an Android emulator, this script will work fine, but when I build the build and run it on my phone, an exception is thrown: exception an Android phone

How I can fix it?

Thanks a lot for answer and sorry my english is not good enough.

1

There are 1 answers

0
vasilisa burina On BEST ANSWER

The renpy.file method can be used to resolve the exception:

label start:
    $ import json
    $ f = renpy.file("resources/string.json")
    $ text = json.load(f)