Thanks. Yes, my usual approach has been to first create the .spec file and
then modify it as needed. Here's a summary of what I tried using a script,
hello_world.py, which creates a simple tkinter gui with a close button.

1. pyinstaller hello_world.py --one file.
This works fine of course--the dist folder contains a single executable.

2. pyinstaller hello_world.spec
Now the dist folder contains a folder, hello_world, not a single
executable. This isn't what I want.

3. pyinstaller hello_world.spec --one file.
Same outcome as (2)

In my more complicated application, I'll need to modify the spec file to
include numerous data files, specify hidden imports, and add an icon. So
the ultimate question is how do I modify the spec file so that dist
contains a single executable? In other words, what modification to the spec
file accomplishes the same thing as using the command line option --onefile?



On Tue, Feb 8, 2022 at 3:47 AM Eric Fahlgren <[email protected]> wrote:

> On Mon, Feb 7, 2022 at 7:48 AM Paul Fishback <[email protected]>
> wrote:
>
>> So, following the steps at
>> https://pyinstaller.readthedocs.io/en/stable/spec-files.html, I could
>> add the run time option -F,--onefile in my spec file by defining
>>
>> options=[('F' ,None,'OPTION')]
>>
>> and including this as a parameter of my EXE instance, e.g.
>>
>> exe = EXE(pyz,
>>           a.scripts,
>>           [],
>>           options,...)
>>
>
> I believe that 'options' is for Python runtime, not for PyInstaller
> command line.  You need to generate a .spec file that aggregates the
> binaries into the EXE phase.   The easiest way to do that is
>
> > pyinstaller --onefile myscript.py
>
> and then use the 'myscript.spec' as the basis for any further
> modifications.  Once you have the .spec file, then feed it to pyinstaller,
> instead of the script.
>
> > pyinstaller myscript.spec
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "PyInstaller" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/pyinstaller/1D5iK9Uv2TE/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pyinstaller/CAP2Qz%2BVW67vrO25M52ubqT9y5DmaEUFX1txwW5fEnAnfZEsmEg%40mail.gmail.com
> <https://groups.google.com/d/msgid/pyinstaller/CAP2Qz%2BVW67vrO25M52ubqT9y5DmaEUFX1txwW5fEnAnfZEsmEg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/pyinstaller/CACWiRmn_HGQPmQpg19dTvGu0dPeC3n3uFZ%2BdwAsXseJT52Nb%3Dg%40mail.gmail.com.

Reply via email to