Command prompt not shown when running Python script with subprocess on Windows

Stephen Hansen me+python at ixokai.io
Tue May 27 02:38:28 EDT 2014


You need to call python.exe path-to-script.py, I think, not just
path-to-script.py. See sys.executable (though that depends on if you're a
frozen app or not).

I can't be sure though because there's no code. Show code when asking
questions, it helps frame the discussion and get a better answer ;)


On Mon, May 26, 2014 at 5:03 PM,
<ps16thypresenceisfullnessofjoy at gmail.com>wrote:

> I have written a Python script with a wxPython GUI that uses
> subprocess.Popen to open a list of files that the user provides. One of my
> users would like to be able to run a Python script with my application. The
> Python script he is trying to run uses the command line and gets keyboard
> input from the user several times.
>
> The problem is that if the Python script is run on Windows with
> subprocess.Popen, no command prompt is shown (my GUI application is a .pyw
> file). The user's script runs silently but then does not quit because it is
> waiting for input, but there is no way for the input to be given, since
> there is no command prompt visible.
>
> I think this may be related to the fact that I am calling subprocess.Popen
> with shell=True. I tried calling it with shell=False (the default), but
> then I got an error that the file is not a valid Win32 application.
>
> I would appreciate any help with this problem.
>
> -- Timothy
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20140526/1d878c66/attachment.html>


More information about the Python-list mailing list