Runtime app cannot find PNG resources unless starts from _internal

11 views
Skip to first unread message

Karen L

unread,
Aug 5, 2025, 2:24:53 PMAug 5
to PyInstaller
I packaged some png files but it is not shown in the app, except when I start the app from the _internal directory. i.e. /path/to/_internal> ../workflow  I put everything in the same directory trying to make it work, but it is not working. Is this a bug?  Following is how I make the executable and the png files are inside the _internal directory. 

pyinstaller -y --clean --onefile --onedir --add-data myapp/resources:. --icon myapp.icns myapp/workflow.py

Chris Barker

unread,
Aug 5, 2025, 2:38:45 PMAug 5
to pyins...@googlegroups.com
How is the app deciding where to look for the PNG files?

It sounds like it may be using the current working dir -- which is not ideal.

If you have control of that code, you'll want to use another way to find them. 

I tend to put that kind of thing inside a python package, and use a path relative to a __file__ in a code file.

You also might be able to use:

import sys
if getattr(sys, 'frozen', False) and hasattr(sys, '_MEIPASS'):
    print('running in a PyInstaller bundle')
else:
    print('running in a normal Python process')
and then `sys.executable`

-CHB


On Tue, Aug 5, 2025 at 11:25 AM Karen L <engineerby...@gmail.com> wrote:
I packaged some png files but it is not shown in the app, except when I start the app from the _internal directory. i.e. /path/to/_internal> ../workflow  I put everything in the same directory trying to make it work, but it is not working. Is this a bug?  Following is how I make the executable and the png files are inside the _internal directory. 

pyinstaller -y --clean --onefile --onedir --add-data myapp/resources:. --icon myapp.icns myapp/workflow.py

--
You received this message because you are subscribed to the Google Groups "PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyinstaller...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/pyinstaller/f69b0797-ab59-4af0-bf4a-62a67d4f1eefn%40googlegroups.com.


--

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris....@noaa.gov
Reply all
Reply to author
Forward
Message has been deleted
0 new messages