Shell=True has occasionally dangerous issues, however I don't think you
should run into any of them.


On Sat, Feb 1, 2014 at 9:09 AM, <[email protected]> wrote:

> All,
>
> For me, setting subprocess popen argument shell=True helped. That will
> keep the console window from popping up but allows any further windows
> created by the subprocess to show up correctly on screen. Using
> STARTUPINFO() directly made all subprocess windows hidden.
>
>         gpl = subprocess.Popen("application",stdin=subprocess.PIPE,
> stdout=subprocess.PIPE,
>                                 stderr=subprocess.PIPE, shell=True)
>
> So eventually this was a python issue rather than a pyinstaller issue. It
> just showed up only when using the application packed as a exe file.
>
> Tomas
>
>
> Den fredagen den 31:e januari 2014 kl. 14:17:39 UTC+2 skrev Tomas Melin:
>>
>> Hi,
>>
>> I'm facing similar kind of problems although a bit different.
>>
>> In my case, the subprocess opens a new window on its own and the
>> pyinstaller -noconsole option does not seem to apply to that window.
>> In addition to the new window that I want, I get an additional empty
>> terminal window. The solution as suggested by Bryan does not work
>> since I actually want the window to stay open, but I don't want the
>> console.
>>
>> Any ideas on how to handle that case so that the -noconsole also
>> applies to any windows opened by subprocesses?
>>
>> Windows 7
>> Python 2.6.2
>> PyInstaller 2.1
>>
>>
>> Thankful for any help.
>> BR,
>> Tomas Melin
>>
>>
>>
>> >Re: [PyInstaller] --noconsole on Windows and subprocess call
>> >
>> >Bryan A. Jones Fri, 24 Jan 2014 14:33:47 -0800
>> >
>> >All,
>> >
>> >Another programmer helped me find a nice approach that still uses the
>> newer
>> >subprocess module. Is there a good place to post this on the Pyinstaller
>> >site? I hope that it can help others who stumble across the same
>> problem.
>> >This works directly from Python, and from the pyinstaller binary, and
>> from
>> >the pyinstaller binary when using --noconsole.
>> >
>> >
>> >import subprocess
>> >with open('out.txt', 'w') as f:
>> >    try:
>> >        si = subprocess.STARTUPINFO()
>> >        si.dwFlags |= subprocess.STARTF_USESHOWWINDOW
>> >        h = subprocess.check_output(['python', '--help'],
>> >            stdin=subprocess.PIPE,
>> >            stderr=subprocess.PIPE,
>> >            startupinfo=si)
>> >        f.write(h)
>> >    except OSError as e:
>> >        f.write('Failed: ' + str(e))
>> >
>> >
>> >On Sat, Jan 11, 2014 at 1:47 PM, Michael Hipp <[email protected]> wrote:
>> >
>> >> Have you tried calling it something like this:
>> >> Popen(cmd, creationflags=win32process.CREATE_NO_WINDOW)
>> >>
>> >>
>> >> On Fri, Jan 10, 2014 at 3:00 PM, Bryan A. Jones <
>> [email protected]>wrote:
>> >>
>> >>> All,
>> >>>
>> >>> I'm stuck with a Pyinstaller problem (Windows 7, latest pyinstaller
>> from
>> >>> git, Python 2.7). I'd like to create an application without a console
>> >>> window, so I pass --noconsole to pyinstaller. However, I also call
>> some
>> >>> external programs from my application, which is causing problems:
>> >>>
>> >>>    1. If I use subprocess.call and friends, I get the exception
>> OSError
>> >>>    exception "[Error 6] the handle is invalid." This is because a
>> noconsole
>> >>>    app has no stdin/stdout/stderr; by default, subprocess tries to
>> pass these
>> >>>    on to the child process, which fails.
>> >>>    2. If I use subprocess.call with stdin=PIPE, stdout=PIPE,
>> stderr=PIPE
>> >>>    (which opens a pipe between the child process and my parent Python
>> >>>    process), everything works, but I get a command window that
>> appears
>> >>> briefly
>> >>>    on the screen. Because I call this child process a lot, I see a
>> lot of
>> >>>    distracting consoles opening and closing.
>> >>>    3. Trying op.spawnl produces identical results to #2.
>> >>>
>> >>> All the code works fine when running without --noconsole or running
>> >>> directly from Python. Any ideas on how to run a child subprocess
>> >>> successfully, but without opening a console window?
>> >>>
>> >>> Thanks!
>> >>>
>> >>> Bryan
>> >>> --
>> >>> Bryan A. Jones, Ph.D.
>> >>> Associate Professor
>> >>> Department of Electrical and Computer Engineering
>> >>> 231 Simrall / PO Box 9571
>> >>> Mississippi State University
>> >>> Mississippi state, MS 39762
>> >>> http://www.ece.msstate.edu/~bjones
>> >>> bjones AT ece DOT msstate DOT edu
>> >>> voice 662-325-3149
>> >>> fax 662-325-2298
>> >>>
>> >>> Our Master, Jesus Christ, is on his way. He'll show up right on
>> >>> time, his arrival guaranteed by the Blessed and Undisputed Ruler,
>> >>> High King, High God.
>> >>> - 1 Tim. 6:14b-15 (The Message)
>> >>>
>> >>> --
>> >>> 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.
>> >>>
>> >>
>> >>  --
>> >> 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.
>> >>
>> >
>> >
>> >
>> >--
>> >Bryan A. Jones, Ph.D.
>> >Associate Professor
>> >Department of Electrical and Computer Engineering
>> >231 Simrall / PO Box 9571
>> >Mississippi State University
>> >Mississippi state, MS 39762
>> >http://www.ece.msstate.edu/~bjones
>> >bjones AT ece DOT msstate DOT edu
>> >voice 662-325-3149
>> >fax 662-325-2298
>> >
>> >Our Master, Jesus Christ, is on his way. He'll show up right on
>> >time, his arrival guaranteed by the Blessed and Undisputed Ruler,
>> >High King, High God.
>> >- 1 Tim. 6:14b-15 (The Message)
>> >
>> >--
>> >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.
>> >
>> >    Previous message
>> >    View by thread
>> >    View by date
>> >    Next message
>> >
>> >    [PyInstaller] --noconsole on Windows and subprocess call Bryan A.
>> Jones
>> >        Re: [PyInstaller] --noconsole on Windows and subproce... Martin
>> Zibricky
>> >            Re: [PyInstaller] --noconsole on Windows and subp... Bryan
>> A. Jones
>> >        Re: [PyInstaller] --noconsole on Windows and subproce... Michael
>> Hipp
>> >            Re: [PyInstaller] --noconsole on Windows and subp...Bryan A.
>> Jones
>> >                Re: [PyInstaller] --noconsole on Windows and ... Michael
>> Hipp
>> >                    Re: [PyInstaller] --noconsole on Windows ... Bryan
>> A. Jones
>> >                        Re: [PyInstaller] --noconsole on Win... Steve
>> Barnes
>> >                            Re: [PyInstaller] --noconsole on... Bryan A.
>> Jones
>> >                                Re: [PyInstaller] --noconsol... Steve
>> Barnes
>> >                                Re: [PyInstaller] --noconsol... Bryan A.
>> Jones
>> >                                Re: [PyInstaller] --noconsol... Steve
>> Barnes
>> >
>>
>  --
> 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.
>

-- 
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.

Reply via email to