Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #28977 > unrolled thread
| Started by | janis.judvaitis@gmail.com |
|---|---|
| First post | 2012-09-12 08:26 -0700 |
| Last post | 2012-09-12 19:49 -0400 |
| Articles | 2 — 2 participants |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: using subprocess.Popen does not suppress terminal window on Windows janis.judvaitis@gmail.com - 2012-09-12 08:26 -0700
Re: using subprocess.Popen does not suppress terminal window on Windows Dave Angel <d@davea.name> - 2012-09-12 19:49 -0400
| From | janis.judvaitis@gmail.com |
|---|---|
| Date | 2012-09-12 08:26 -0700 |
| Subject | Re: using subprocess.Popen does not suppress terminal window on Windows |
| Message-ID | <b0b48937-801b-413e-843a-b0e557fbb7de@googlegroups.com> |
Hi, and I'm sorry for using this old thread, but I'm experiencing the same problem, except, that I wan't to execute any shell script or exe without blank terminal window.
Is there any way in python to supress blank console screen while script is executing? Multiplatform solution would be nice.
With best regards, Jānis.
On Friday, June 18, 2010 7:23:19 PM UTC+3, Steven wrote:
> I am calling a ruby program from a python gui and using
> subprocess.Popen in Windows XP using python 2.6. Unfortunately,
> whenever the ruby program is called a blank command window appears on
> screen, annoying my users. Is there a way to suppress this behaviour?
>
> Below is a minimal program that demonstrates the problem. The problem
> does not manifest if the python program is launched via the command
> line. To duplicate launch from Windows Explorer by double-clicking on
> the python file.
>
> --- call_double.pyw ---
> from subprocess import *
> import time
>
> time.sleep(3) # to show that command window is result of call to Popen
> p = Popen(['ruby.exe', 'double.rb'], stdin=PIPE, stdout=PIPE,
> stderr=PIPE)
> results = open('results.txt', 'w')
> for n in range(10):
> p.stdin.write("%d\n" % n)
> result = p.stdout.readline().strip()
> results.write('double(%s) => %2s\n' % (n, result))
> results.close()
>
> --- end of call_double.pyw ---
>
> --- double.rb ---
> while true
> puts $stdin.gets().strip!.to_i * 2
> STDOUT.flush
> end
> --- end of double.rb ---
>
> thanks for any help,
> Steven Rumbalski
I
[toc] | [next] | [standalone]
| From | Dave Angel <d@davea.name> |
|---|---|
| Date | 2012-09-12 19:49 -0400 |
| Message-ID | <mailman.584.1347493774.27098.python-list@python.org> |
| In reply to | #28977 |
On 09/12/2012 11:26 AM, janis.judvaitis@gmail.com wrote: > Hi, and I'm sorry for using this old thread, but I'm experiencing the same problem, except, that I wan't to execute any shell script or exe without blank terminal window. > Is there any way in python to supress blank console screen while script is executing? Multiplatform solution would be nice. > With best regards, Jānis. > it's not clear from your question: Are you launching non-Python programs from a python one, using Popen? If so, I can't help. It's the launchee that determines if a console is created, as best as I know. However, if you're trying to launch a python program without its getting a console, then read on. No need for a multiplatform solution, since the problem is a Windows one. Windows will create a console for a new process unless the parent console is still available (eg. you run it from command line) or unless the executable is marked with the "no console" flag. (I don't recall what that's actually called, I haven't used Windows in a long time). Anyway, in the Windows version, there are two executables python.exe and pythonw.exe. You want the latter one, either by explicitly naming it in your launcher (batch file, script, whatever), or by using the .pyw extension, which is normally associated with the pythonw.exe program. -- DaveA
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web