Build distribute, cannot find game files error

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
wtfman
Regular
Posts: 37
Joined: Sat Mar 30, 2013 7:26 pm
Contact:

Build distribute, cannot find game files error

#1 Post by wtfman »

When I build and run a distributed game, always get an error message that the file can not be found.
('Couldn't find file (Filename)' error)

------------------------------------
For example:

1. Saved my game's data in each separate folders. ex)image, sound, music
2. Add the following lines in options.rpy file.

build.archive("image", "all")
build.archive("sound", "all")
build.archive("music", "all")

build.classify('game/image/*.png', 'image')
build.classify('game/sound/*.wav', 'sound')
build.classify('game/music/*.mp3', 'music')

-> I have verified that each .rpa file is created when build distribute(image.rpy, sound.rpy, music.rpy)

3. Build distribute and run
4. 'Couldn't find file (Filename)' Error occurred
------------------------------------

I have found one solution: Move all of the game files in each separate folders to 'game' folder and build.
or if the folder name is 'images' rather than 'image', no error occurs.

But I don't think this is the right solution... How can I archive the data in each folder and make it work in the distribution?

User avatar
xavimat
Eileen-Class Veteran
Posts: 1461
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Discord: xavimat
Contact:

Re: Build distribute, cannot find game files error

#2 Post by xavimat »

Many things could go wrong here.

I have to ask: Is your game working OK before builds?
I mean, in your list: 1. Saved the data... Does this mean that you move your data after coding? (I'm sure it doesn't, but I ask just in case)

If you have subfolders in these three folders, you need double **:

Code: Select all

build.classify('game/graphics/**.png', 'image')
build.classify('game/sound/**.wav', 'sound')
build.classify('game/music/**.mp3', 'music')
Also, maybe is not a problem in your builds, simply a file missing.

I suggest you to use .ogg instead of wav or mp3, for different reasons (wav is larger, mp3 is not open).
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

wtfman
Regular
Posts: 37
Joined: Sat Mar 30, 2013 7:26 pm
Contact:

Re: Build distribute, cannot find game files error

#3 Post by wtfman »

Not. I mean "stored" game data files in each separate folders(of course before coding, and using config.searchpath.append)
and before the build, it does work well.

Anyway, I try to use double *, but it doesn't work, too.

User avatar
PyTom
Ren'Py Creator
Posts: 16096
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: Build distribute, cannot find game files error

#4 Post by PyTom »

Can we have the actual code? It's hard to tell what's going on - it's not obvious that build.archive is in an init python block.

Also, the actual error message is important to have. It contains information that's not clear from your description of the error.
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

wtfman
Regular
Posts: 37
Joined: Sat Mar 30, 2013 7:26 pm
Contact:

Re: Build distribute, cannot find game files error

#5 Post by wtfman »

Aye. Here is all of the data what you need.



Directories: http://i.imgur.com/bqSXHiA.png

Filelist:
Image http://i.imgur.com/P4whBW5.png
Music http://i.imgur.com/zuuq69O.png
Sound http://i.imgur.com/rTxrd0Z.png


3 Archived files: http://i.imgur.com/dYYEkRd.png

Code in options.rpy file

Code: Select all

init python:
    build.directory_name = "alien-1.0"
    build.executable_name = "alien"

    build.include_update = False

    build.classify('**~', None)
    build.classify('**.bak', None)
    build.classify('**/.**', None)
    build.classify('**/#**', None)
    build.classify('**/thumbs.db', None)
    
    build.archive("img", "all")
    build.archive("sound", "all")
    build.archive("music", "all")

    build.classify('game/img/*.png', 'img')
    build.classify('game/sound/**.wav', 'sound')
    build.classify('game/music/**.ogg', 'music')
    

    build.documentation('*.html')
    build.documentation('*.txt')
And this is an error message when running a distributed game
(It runs well when in Ren'py launcher)

Code: Select all

[code]
I'm sorry, but an uncaught exception occurred.

While loading <'Image' 'alien_main.png'>:
  File "game/script.rpy", line 252, in script
    $ renpy.pause()
  File "game/script.rpy", line 252, in <module>
    $ renpy.pause()
IOError: Couldn't find file 'alien_main.png'.

-- Full Traceback ------------------------------------------------------------

Full traceback:
  File "game/script.rpy", line 252, in script
    $ renpy.pause()
  File "D:\alien-1.0-dists\alien-1.0-win\renpy\ast.py", line 806, in execute
    renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
  File "D:\alien-1.0-dists\alien-1.0-win\renpy\python.py", line 1577, in py_exec_bytecode
    exec bytecode in globals, locals
  File "game/script.rpy", line 252, in <module>
    $ renpy.pause()
  File "D:\alien-1.0-dists\alien-1.0-win\renpy\exports.py", line 1254, in pause
    rv = renpy.ui.interact(mouse='pause', type='pause', roll_forward=roll_forward)
  File "D:\alien-1.0-dists\alien-1.0-win\renpy\ui.py", line 277, in interact
    rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
  File "D:\alien-1.0-dists\alien-1.0-win\renpy\display\core.py", line 2425, in interact
    repeat, rv = self.interact_core(preloads=preloads, **kwargs)
  File "D:\alien-1.0-dists\alien-1.0-win\renpy\display\core.py", line 2779, in interact_core
    self.draw_screen(root_widget, fullscreen_video, (not fullscreen_video) or video_frame_drawn)
  File "D:\alien-1.0-dists\alien-1.0-win\renpy\display\core.py", line 1848, in draw_screen
    renpy.config.screen_height,
  File "renpy/display/render.pyx", line 416, in renpy.display.render.render_screen (gen\renpy.display.render.c:6685)
    rv = render(root, width, height, 0, 0)
  File "renpy/display/render.pyx", line 185, in renpy.display.render.render (gen\renpy.display.render.c:2857)
    rv = d.render(widtho, heighto, st, at)
  File "D:\alien-1.0-dists\alien-1.0-win\renpy\display\layout.py", line 649, in render
    surf = render(child, width, height, cst, cat)
  File "renpy/display/render.pyx", line 103, in renpy.display.render.render (gen\renpy.display.render.c:3319)
    cpdef render(d, object widtho, object heighto, double st, double at):
  File "renpy/display/render.pyx", line 185, in renpy.display.render.render (gen\renpy.display.render.c:2857)
    rv = d.render(widtho, heighto, st, at)
  File "D:\alien-1.0-dists\alien-1.0-win\renpy\display\layout.py", line 649, in render
    surf = render(child, width, height, cst, cat)
  File "renpy/display/render.pyx", line 103, in renpy.display.render.render (gen\renpy.display.render.c:3319)
    cpdef render(d, object widtho, object heighto, double st, double at):
  File "renpy/display/render.pyx", line 185, in renpy.display.render.render (gen\renpy.display.render.c:2857)
    rv = d.render(widtho, heighto, st, at)
  File "D:\alien-1.0-dists\alien-1.0-win\renpy\display\layout.py", line 649, in render
    surf = render(child, width, height, cst, cat)
  File "renpy/display/render.pyx", line 103, in renpy.display.render.render (gen\renpy.display.render.c:3319)
    cpdef render(d, object widtho, object heighto, double st, double at):
  File "renpy/display/render.pyx", line 185, in renpy.display.render.render (gen\renpy.display.render.c:2857)
    rv = d.render(widtho, heighto, st, at)
  File "renpy/display/accelerator.pyx", line 104, in renpy.display.accelerator.transform_render (gen\renpy.display.accelerator.c:1965)
    cr = render(child, widtho, heighto, st - self.child_st_base, at)
  File "renpy/display/render.pyx", line 185, in renpy.display.render.render (gen\renpy.display.render.c:2857)
    rv = d.render(widtho, heighto, st, at)
  File "D:\alien-1.0-dists\alien-1.0-win\renpy\display\image.py", line 261, in render
    return wrap_render(self.target, width, height, st, at)
  File "D:\alien-1.0-dists\alien-1.0-win\renpy\display\image.py", line 124, in wrap_render
    rend = render(child, w, h, st, at)
  File "renpy/display/render.pyx", line 103, in renpy.display.render.render (gen\renpy.display.render.c:3319)
    cpdef render(d, object widtho, object heighto, double st, double at):
  File "renpy/display/render.pyx", line 185, in renpy.display.render.render (gen\renpy.display.render.c:2857)
    rv = d.render(widtho, heighto, st, at)
  File "D:\alien-1.0-dists\alien-1.0-win\renpy\display\im.py", line 478, in render
    im = cache.get(self)
  File "D:\alien-1.0-dists\alien-1.0-win\renpy\display\im.py", line 200, in get
    surf = image.load()
  File "D:\alien-1.0-dists\alien-1.0-win\renpy\display\im.py", line 529, in load
    surf = renpy.display.pgrender.load_image(renpy.loader.load(self.filename), self.filename)
  File "D:\alien-1.0-dists\alien-1.0-win\renpy\loader.py", line 533, in load
    raise IOError("Couldn't find file '%s'." % name)
IOError: Couldn't find file 'alien_main.png'.

Windows-7-6.1.7601-SP1
Ren'Py 6.99.10.1227
alien 0.0
[/code]

Please help me. I can't sleep well when thinking about this.

User avatar
Divona
Miko-Class Veteran
Posts: 678
Joined: Sun Jun 05, 2016 8:29 pm
Completed: The Falconers: Moonlight
Organization: Bionic Penguin
itch: bionicpenguin
Contact:

Re: Build distribute, cannot find game files error

#6 Post by Divona »

Try this:

Code: Select all

init python:
    build.directory_name = "alien-1.0"
    build.executable_name = "alien"

    build.include_update = False

    build.classify('**~', None)
    build.classify('**.bak', None)
    build.classify('**/.**', None)
    build.classify('**/#**', None)
    build.classify('**/thumbs.db', None)
    
    build.archive("img", "all")
    build.archive("sound", "all")
    build.archive("music", "all")

    build.classify('game/**.png', 'img')
    build.classify('game/**.wav', 'sound')
    build.classify('game/**.ogg', 'music')
    
    build.documentation('*.html')
    build.documentation('*.txt')
Completed:
Image

wtfman
Regular
Posts: 37
Joined: Sat Mar 30, 2013 7:26 pm
Contact:

Re: Build distribute, cannot find game files error

#7 Post by wtfman »

I tried your solution. But it doesn't work too. Same error is occurred.

Code: Select all

init -1 python hide:
    config.searchpath.append('game')
    config.searchpath.append('game/img')
    config.searchpath.append('game/sound')
    config.searchpath.append('game/music')

    config.screen_width = 1024
    config.screen_height = 640

    config.window_title = u"ALIEN INTERCEPTOR"

    config.name = "alien"
    config.version = "0.0"


    theme.tv(
        (skip)
        )


    config.has_sound = True
    config.has_music = True
    config.has_voice = False

    config.help = "README.html"

    config.enter_transition = None
    config.exit_transition = None
    config.intra_transition = None
    config.main_game_transition = None
    config.game_main_transition = None
    config.end_splash_transition = None
    config.end_game_transition = None
    config.after_load_transition = None
    config.window_show_transition = None
    config.window_hide_transition = None
    config.adv_nvl_transition = dissolve
    config.nvl_adv_transition = dissolve
    config.enter_yesno_transition = None
    config.exit_yesno_transition = None
    config.enter_replay_transition = None
    config.exit_replay_transition = None
    config.say_attribute_transition = None

python early:
    config.save_directory = "alien-1486990360"

init -1 python hide:
    config.default_fullscreen = False
    config.default_text_cps = 0
    config.default_afm_time = 10

init python:
    build.directory_name = "alien-1.0"
    build.executable_name = "alien"

    build.include_update = False

    build.classify('**~', None)
    build.classify('**.bak', None)
    build.classify('**/.**', None)
    build.classify('**/#**', None)
    build.classify('**/thumbs.db', None)
    
    build.archive("img", "all")
    build.archive("sound", "all")
    build.archive("music", "all")

    build.classify('game/**.png', 'img')
    build.classify('game/**.wav', 'sound')
    build.classify('game/**.ogg', 'music')
    
    build.documentation('*.html')
    build.documentation('*.txt')
This is the full of options.rpy file.

User avatar
Divona
Miko-Class Veteran
Posts: 678
Joined: Sun Jun 05, 2016 8:29 pm
Completed: The Falconers: Moonlight
Organization: Bionic Penguin
itch: bionicpenguin
Contact:

Re: Build distribute, cannot find game files error

#8 Post by Divona »

Alright. I have tested it out, and it seems to be a problem with "config.searchpath" not working in the build distributions. Get rid of those, change folder name "img" to "images" and it's all good. Else you just have to add a specific folder to the front of every file path, which makes "searchpath" a no use. Might have to do that for sound and music, though.

Code: Select all

image "img/alien_main.png"
Completed:
Image

wtfman
Regular
Posts: 37
Joined: Sat Mar 30, 2013 7:26 pm
Contact:

Re: Build distribute, cannot find game files error

#9 Post by wtfman »

Great. It does work perfectly. Thank you Divona!
But why 'config.searchpath' command doesn't work in distributed?

User avatar
Divona
Miko-Class Veteran
Posts: 678
Joined: Sun Jun 05, 2016 8:29 pm
Completed: The Falconers: Moonlight
Organization: Bionic Penguin
itch: bionicpenguin
Contact:

Re: Build distribute, cannot find game files error

#10 Post by Divona »

wtfman wrote:But why 'config.searchpath' command doesn't work in distributed?
I have no idea. Probably a Ren'Py bug? It is reside under rarely or internally used section of the documentation after all.
Completed:
Image

User avatar
PyTom
Ren'Py Creator
Posts: 16096
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: Build distribute, cannot find game files error

#11 Post by PyTom »

It's not a bug, it's just that config.searchpath is meant for files on disk, not files in archives. It's used to find the archives, among other things.
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: Ahrefs [Bot], Google [Bot]