Launching scripts in Ubuntu ?

Stef Mientki stef.mientki at
Tue Oct 14 15:46:34 CEST 2008

Diez B. Roggisch wrote:
>>> What do you mean "it's not closed"?
>> 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.
>> This might not sound important,
>> but the problem is somewhat more complex,
>> all these scripts are ran from another program,
>> and although everything works fine under windows,
>> the program hangs on Ubuntu.
>> So I guess that this is the (first) problem to solve.
> This looks odd. I've never seen a *shell* display ">>>" as prompt.
">>>"  stands for:
stef at stef-desktop:/media/disk/Data_Python_25/support$

>  So it
> looks as if you mix stuff between the shell (bash, tcsh, whatever) and
> python in the above. Are you *inside* the python interpreter already when
> typing "python"? 
So no
> And if *not*, does typing e.g. "ls <return>" work for you, right after the
> is run?
yes it does
>  Then there is no "getting back of the prompt", it's just
> that a last newline is .. well, not even missing, just not printed.
> Consider this (I use $ for the shellpromt):
> $ python -c "import sys;sys.stdout.write('hello')"
> hello$
> 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.
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 

thank you all,

More information about the Python-list mailing list