Launching scripts in Ubuntu ?

Gabriel Genellina gagsl-py2 at
Tue Oct 14 21:32:39 CEST 2008

En Tue, 14 Oct 2008 10:46:34 -0300, Stef Mientki <stef.mientki at>  

>>> well the command prompt (if it is called that way in Linus) is not
>>> returned.
>>> When I run file_support, the command window looks like this
>>>  >>>python
>>> ..... all kinds of output
>>>  >>>
>>> When I run (which calls fie_support) , I get this
>>>  >>>python
>>> .... all kinds of output (the same as before)
>>> Now I've to explicitly press an enter to get the command prompt back.

> ok It seems to be solved now,
> In creating a small example to emphasize the problem,
> I found the difference between Win and Linux:
> In windows "shell=True" and in Linux "shell=False"
>   PID = subprocess.Popen( arguments,
>                           cwd   = cwd ,
>                           stdout = subprocess.PIPE,
>                           stderr = subprocess.PIPE,
>                           shell =  ( == 'nt') )
> so the above statement seems (at least for the moment) solve all the  
> problems.

I'd say there is no problem. It just *appears* to be one. The first  
program finishes, and the shell displays its prompt, while the child is  
still outputting things. I bet you can see the stef at stef-desktop...$  
somewhere in the output.

It's like executing:
$ ls&
the shell prompt is shown as soon as the ls (background) process starts,  
but gets lost in the output.

> Diez B. Roggisch wrote:
>> Additonally, you might want to check out the Popen-object-reference for  
>> the
>> wait-call, but actually that shouldn't change anything with regards to
>> pressing enter or not.

Calling wait in the parent script would prevent it to finish before the  
child, avoiding the issue.

Gabriel Genellina

More information about the Python-list mailing list