dos promt simulation

I.C. theivo at abv.bg
Sun Apr 14 04:19:23 EDT 2002


bokr at oz.net (Bengt Richter) wrote in message news:<a9aqr4$moh$0 at 216.39.172.122>...
> On 13 Apr 2002 14:39:58 -0700, theivo at abv.bg (I.C.) wrote:
> 
> >> there is also popen2, popen3 etc. they give you a file for stdin where you 
> >> can write to.
> >
> >Maybe popen2\3 could help, but I think, I don't use them correctly :
> >
> >import os
> >dos_input, dos_output = os.popen2('time')
> >
> >for line in dos_output.readlines(): # Current time is 22:14:43,24
> >        print line                  # Enter new time:
> >
> >dos_input.write(raw_input())        # User enters the new time
>   ^^^^^--??
> >
> >Where is my mistake?
> >
> I would guess that's probably one.
> 
> Regards,
> Bengt Richter

Can somebody give me an example, which uses popen2?
Thank you!

Ivo



More information about the Python-list mailing list