Figured it out. See below for an example of how to load resources files
from _MEIPASS. My data files were in a ../data directory and my final exe
entry in the spec file was this:
exe = EXE(pyz,
Tree('C:\\full\\path\\to\\data', prefix='data\\'),
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
debug=False,
strip=None,
upx=True,
console=True
On Friday, November 22, 2013 7:24:22 PM UTC-5, Tim Pierson wrote:
>
> Happy Friday everyone.
> I've tried numerous ways to get data files (--I have two Qt .ui files
> loaded via PyQt.uic--)into an .exe and I can't seem to pull it off.
>
> My last idea, following a previous post in this list, was to put the .ui
> files in a \data directory and then add this to my .spec file like so:
>
> exe = EXE(pyz,
> Tree("data", prefix="data"),
> a.scripts,
> a.binaries,
> a.zipfiles,
> a.datas,
> name='TagBrowser.exe',
> debug=False,
> strip=None,
> upx=True,
> console=True
>
>
> rebuilding with the spec file however throws this: "The system cannot find
> the path specified: 'data/*.*'
> adding more or different "\"s doesn't change things.
>
>
> the .ui's are called from my main.py like this:
>
> def resource_path(relative):
> if hasattr(sys, "_MEIPASS"):
> return os.path.join(sys._MEIPASS, relative)
> return os.path.join(relative)
>
> uic.loadUi(resource_path(os.path.join('data','loginQt.ui')), self)
>
>
> I've also tried adapting this recipe:
> http://www.pyinstaller.org/wiki/Recipe/CollectDatafiles<http://www.google.com/url?q=http%3A%2F%2Fwww.pyinstaller.org%2Fwiki%2FRecipe%2FCollectDatafiles&sa=D&sntz=1&usg=AFQjCNEfFQk5lqrX1f7mhXY1iXUJhzdlKg>
>
> But no go.
>
> Any suggestions?
> Thanks,
>
>
>
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pyinstaller.
For more options, visit https://groups.google.com/groups/opt_out.