【问题标题】:Renpy, an exception when trying to build a build on Android (renpy.loader.transfn)Renpy,尝试在 Android 上构建构建时出现异常 (renpy.loader.transfn)
【发布时间】:2021-04-27 19:16:56
【问题描述】:

假设 ./resources 中有一个名为“string.json”的 json 文件。那么这个文件的解析可以这样实现:

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

在 PC 和 Android 模拟器上,此脚本可以正常运行,但是当我构建构建并在手机上运行它时,会引发异常: exception an Android phone

我该如何解决?

非常感谢您的回答,抱歉我的英语不够好。

【问题讨论】:

    标签: python android json apk renpy


    【解决方案1】:

    可以使用renpy.file方法解决异常:

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

    【讨论】:

      猜你喜欢
      • 2022-11-02
      • 2018-11-21
      • 1970-01-01
      • 2020-11-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-06-18
      • 1970-01-01
      相关资源
      最近更新 更多