Re: [Tutor] Python popen command using cat > textfile .... how to terminate

2009-05-17 Thread Walker Hale IV
On Fri, May 15, 2009 at 12:46 PM, Noufal Ibrahim wrote: > MK wrote: >> >> Hi there, >> >> i am using this code to send an "cat > ThisIsMyUrl" with popen. >> Of cos cat now waits for the CTRL+D command. How can i send this command ? > > Wouldn't it be better if you directly opened the "ThisIsMyUrl"

Re: [Tutor] Python popen command using cat > textfile .... how to terminate

2009-05-15 Thread Noufal Ibrahim
MK wrote: Hi there, i am using this code to send an "cat > ThisIsMyUrl" with popen. Of cos cat now waits for the CTRL+D command. How can i send this command ? Wouldn't it be better if you directly opened the "ThisIsMyUrl" file and wrote the text into it rather than rely on shelling out for t

Re: [Tutor] Python popen command using cat > textfile .... how to terminate

2009-05-15 Thread Lie Ryan
MK wrote: Ok. I explain it once more. Its not about reading the console output of the command. Its that i want to put a empty file in my subdirectories so that the name of the file is a message or url or something else. And if you want an empty file you can do that with "cat > IAmAnEmptyFileWith

Re: [Tutor] Python popen command using cat > textfile .... how to terminate

2009-05-15 Thread A.T.Hofkamp
MK wrote: Ok. I explain it once more. Its not about reading the console output of the command. Its that i want to put a empty file in my subdirectories so that the name of the file is a message or url or something else. And if you want an empty file you can do that with "cat > IAmAnEmptyFileWith

Re: [Tutor] Python popen command using cat > textfile .... how to terminate

2009-05-15 Thread Sander Sweers
2009/5/15 MK : > Ok. I explain it once more. Its not about reading the console output of > the command. Its that i want to put a empty file in my subdirectories > so that the name of the file is a message or url or something else. > And if you want an empty file you can do that with > "cat > IAmAnE

[Tutor] Python popen command using cat > textfile .... how to terminate

2009-05-15 Thread MK
Seems that i did it the wrong way still from the beginning. I did it now with open and write an empty file. But anyway i would wish to know if it is possible to terminate a running cat. Thank you all. ___ Tutor maillist - Tutor@python.org http://m

[Tutor] Python popen command using cat > textfile .... how to terminate

2009-05-15 Thread MK
Ok. I explain it once more. Its not about reading the console output of the command. Its that i want to put a empty file in my subdirectories so that the name of the file is a message or url or something else. And if you want an empty file you can do that with "cat > IAmAnEmptyFileWithOnlyAName" u

Re: [Tutor] Python popen command using cat > textfile .... how to terminate

2009-05-14 Thread Sander Sweers
Forwarding to list because of mail delivery error... 2009/5/15 Sander Sweers : > 2009/5/14 MK : >> i am using this code to send an "cat > ThisIsMyUrl" with popen. > > First, I am not sure if you understand what "cat > ThisIsMyUrl" > actually does... It waits for data on *stdin* and pipes it to > T

Re: [Tutor] Python popen command using cat > textfile .... how to terminate

2009-05-14 Thread Martin Walsh
MK wrote: > Hi there, > > i am using this code to send an "cat > ThisIsMyUrl" with popen. > Of cos cat now waits for the CTRL+D command. > How can i send this command ? > > def console_command(cmd): > print cmd > console = os.popen(cmd,"r") > output = console.read() > con

Re: [Tutor] Python popen command using cat > textfile .... how to terminate

2009-05-14 Thread vince spicer
import commands On Thu, May 14, 2009 at 4:28 PM, vince spicer wrote: > Take a peak at commands.getoutput > > > EX: > > import commmands > > ls = commands.getoutput("ls- ls") > > Vince > > > On Thu, May 14, 2009 at 3:50 PM, MK wrote: > >> Hi there, >> >> i am using this code to send an "cat > Th

Re: [Tutor] Python popen command using cat > textfile .... how to terminate

2009-05-14 Thread vince spicer
Take a peak at commands.getoutput EX: import commmands ls = commands.getoutput("ls- ls") Vince On Thu, May 14, 2009 at 3:50 PM, MK wrote: > Hi there, > > i am using this code to send an "cat > ThisIsMyUrl" with popen. > Of cos cat now waits for the CTRL+D command. > How can i send this comm

[Tutor] Python popen command using cat > textfile .... how to terminate

2009-05-14 Thread MK
Hi there, i am using this code to send an "cat > ThisIsMyUrl" with popen. Of cos cat now waits for the CTRL+D command. How can i send this command ? def console_command(cmd): print cmd console = os.popen(cmd,"r") output = console.read() console.close() ret