On Sat, Mar 18, 2017 at 9:49 AM, Owen Walker <[email protected]> wrote:
> I have tried: "pyinstaller --onedir --add-data wavFiles;wavFiles
> myscript.py" and it does not produce an error. Further the folder
> dist/myscript contains not only myscript.exe but also a copy of wavFiles.
>
So far, so good. When you then run myscript.exe FROM INSIDE THAT FOLDER,
e.g.
C:\my_source_directory: dist\myscript\myscript.exe
...or alternatively, in file explorer you have a window open on
dist\myscript and you doubleclick myscript.exe inside it,
it runs how you expect, yes? Finds its wav files and all? Or no?
I'm going to assume "yes" for the rest of this.
> But when you move myscript.exe to a new folder and doublclick on it,
>
OK I don't think it is supported to drag myscript.exe OUT of the myscript
folder and launch it somewhere else.
You could make an alias of it and drag the ALIAS to the desktop for
example, and that should launch.
But in the one-dir model, there is a ton of support stuff in the dir, and
the exe has no way to find it if you separate them.
Relax, I know you would rather have a single .exe. The point of using
--onedir is that you can easily see just what is being included, and at
what level of folder nesting. And now you have.
OK, if you replace --oneDIR with --oneFILE, what gets built is really a
kind of a self-extracting archive which contains EXACTLY what is in the
dist/myscript folder after a --oneDIR run. When you launch the --onefile
executable, it creates a temp directory in temp disk space, and then it
unpacks into that temp dir EXACTLY the contents you can see now in the
--onedir output. Then it launches the same myscript.exe that you are
playing with now.
This is why --onedir mode is useful even if you don't intend to distribute
your app as a folder. You can see what is included, which is normally
hidden inside the --onefile executable.
So, if you now get the expected operation by launching
*dist/myscript/myscript.exe*, you should get the same results if you make
the single change of --onedir to --onefile, rebuild, and launch
*dist/myscript.exe*
BTW just to keep from confusing yourself, you should always include the
option *--clean* in every run. That tells it to throw away residual stuff
in the dist directory. Otherwise you could get your experiments confused.
Dave Cortesi
--
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 https://groups.google.com/group/pyinstaller.
For more options, visit https://groups.google.com/d/optout.