#๐ themes not loading when bundled
69 messages ยท Page 1 of 1 (latest)
@dreamy tapir
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
where is the theme file relative to main.spec
can you send the path for themes/ and show the spec file
"C:\Users\user\OneDrive\Generator Incremental Simulator\src\themes"
# -*- mode: python ; coding: utf-8 -*-
a = Analysis(
['main.py'],
pathex=[],
binaries=[],
datas=[('src/themes/*.json', 'themes')],
hiddenimports=[],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
noarchive=False,
optimize=0,
)
pyz = PYZ(a.pure)
exe = EXE(
pyz,
a.scripts,
a.binaries,
a.datas,
[],
name='main',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=False,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
)
try removing the spaces in ur path. those are never good
wdym
"Generator incremental Simulator" will only give you issues in the future
some programs dont handle spaces in files well
dont think its related to this issue though since its not being used to get themes
ig it could be depending on how whatever you are using builds exes
I am using pyinstaller
same issue
https://pyinstaller.org/en/stable/spec-files.html
pyinstaller --add-data "src/README.txt:." myscript.py
have you tried manually adding the data
to see if that works
yes
what command did you do
the exact one you used
i also used --onefile and --noconsole dunno if there're related
when you have run pyinstaller did it make a themes folder at all
datas=[('src/themes/*.json', 'themes')],
makes a themes folder that puts all the json files
where would that be?
have you looked at the documentation for spec files?
yes and i don't understand a single thing
being able to understand documentation is a really good skill to have
How does that help the app load the files?
Exactly what i said
the same thing you did here
datas=[('src/themes/*.json', 'themes')],
the idea is that you take the example but change it up for your use
This is the path the game is looking for
manager.get_theme().load_theme("src/themes/main_menu_theme.json")
manager.get_theme().load_theme("src/themes/generator_menu_button_theme.json")manager.get_theme().load_theme("src/themes/main_menu_theme.json")
manager.get_theme().load_theme("src/themes/generator_menu_button_theme.json")
well the first thing you would look at is the path
obviously your path isnt /mygame/sfx/
its /src/themes/
you want json files so instead of looking for mp3 just change that to json
I did and it didn't work
i have a hunch its partially because you dont really understand how pyinstaller works
You think i would be here if i did
well sure you can understand something and ask for some help
but pastnig lines into your project hoping someone elses config works is a recipe for unmaintainable code
im not trying to be a dick or anything but i see it a lot
doesn't it copy to a folder called themes?
Idk where pyinstaller created it's files
I just know it creates a temporary folder when the executable is ran
try replacing
datas=[('src/themes/*.json', 'themes')],
with
datas=[('/src/themes/*.json', 'themes')],
their example has a / at the beginning of the path
No the first one was the correct path
Unable to find '\src\themes\*.json' when adding binary and data files.
try moving a theme file into the same directory as your spec file
so you can just put theme.json to load it
so we can see if its a path issue or something else
if it can find the json file in the same directory as it we can narrow the issue down to the path itself, not an issue on a larger scope
I moved the executable to the parent directory so i don't think it's a path issue since the app is literally running
I found the issue
@pliant wind Ok so the game is looking for json files at this location
manager.get_theme().load_theme("src/themes/main_menu_theme.json") src/themes which was making it ignore themes bc that's not the actual directory for the game. I just got what you said earlier.
ah
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.