Home python Renpy, Exception when trying to collect build on Android (reenpy.loader.transfn)

Renpy, Exception when trying to collect build on Android (reenpy.loader.transfn)

Author

Date

Category

Let’s say there is a JSON file lying in ./resources and named “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 the PC and on the Android emulator such a script will work perfectly, but when I collect build and launch it on the phone, then the exception is departed:

Perhaps it is somehow connected with the architecture of APK-package, or some other nuances, but in the documentation I did not find solutions to this problem.


Answer 1

To resolve the exception, you can use the renpy.file

method

That is:

Label Start:
  $ Import json
  $ F = Renpy.file ("Resources / String.json")
  $ text = json.load (f)

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions