Not working glob.glob() in Android build

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
AircGroup
Newbie
Posts: 4
Joined: Sat Feb 12, 2022 8:18 pm
Contact:

Not working glob.glob() in Android build

#1 Post by AircGroup »

Hi,

I have script that auto collect assets for LayeredImage. I write method on base glob(). This gets folders with images for one art and register LayeredImage in Renpy. This method working on Windows (PC) without problem. Assets founded and i can use. But in Android build this method not working. I test on device with root and in place find not have anything assets. I think okay try use as recomend on Android device - use os.environ but this also not working. How i must do finding assets in need folders?

myscript.rpy

Code: Select all

init -9999 python:
    from glob import glob
    import os
    
    def APT_INIT(paths, base="base"):

        for path in paths:

            a_Images = glob(os.path.join(path, "*\\"))
            
            # After i filtering images.
definitions.rpy

Code: Select all

init python:
    try:
        APT_INIT([os.environ["ANDROID_PRIVATE"]+"/mod_assets/APT"])
    except:
        APT_INIT([renpy.config.basedir + "\\game\\mod_assets\\APT"])
PC - Renpy 8.1.3, Windows 7.
Android - BlueStack 5, NoxPlayer, Poco X4 Pro 5G

User avatar
PyTom
Ren'Py Creator
Posts: 16082
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Not working glob.glob() in Android build

#2 Post by PyTom »

Android doesn't write the files to disk.

You need to use renpy.list_files.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

Post Reply

Who is online

Users browsing this forum: Bing [Bot]