redirect or cover .bat log

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Fri Aug 24 04:34:25 CEST 2007


En Thu, 23 Aug 2007 03:42:52 -0300, <vedrandekovic at v-programs.com>  
escribi�:

> On 22 kol, 21:18, vedrandeko... at v-programs.com wrote:
>> On 22 kol, 16:01, Gabriel Genellina <gagsl-... at yahoo.com.ar> wrote:

>> > > > >> > Can I cover or redirect log of that process into my wx  
>> program?
>> > > > >> > I'am using Windows XP SP2, and Python 2.5.
>>
>> > Try the subprocess module. For the single line command you posted
>> > earlier, you don't even need the bat file:
>>
>> > import subprocess
>> > p = subprocess.Popen(["python", "myscript_setup.py", "py2exe"],
>> > stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
>> > p.wait()
>> > output_from_process = p.stdout.readlines()

> This,works fine except this last line:
>
>  output_from_process = p.stdout.readlines()
>
> I get an error:
>
> p has not attribute stdout

It should! p should be an instance of subprocess.Popen - perhaps you  
reassigned some other thing to that name?
(sorry for using a one-letter name, that's not a good idea, you should use  
a much better name instead, in order to avoid naming conflicts)

-- 
Gabriel Genellina




More information about the Python-list mailing list