#python - Wed 25 Apr 2007 between 00:00 and 00:12

NY Lost Funds



ironfroggy_LTlivid: how many lines?
kisielkironfroggy_LT: you're experienced with Popen?
lividwell, it really wouldn't be that many
ironfroggy_LT: basically I will be grabbing information from a tape library, seperated by ;'s and then new lines for each tape
ironfroggy_LTkisielk: suppose you might say something like that.
lividand the most it could be is 21
ironfroggy_LTlivid: and the lines are piped into your scripts stdin?
ZaoI just import commands and use commands.getoutput('whatever')
lividwell, I am using os.system to call the application
kisielkironfroggy_LT: ok, well, I was helping someone here the other day
ironfroggy_LTZao: commands is being replaced with subprocess
lividso like os.system(/usr/local/bin/tapeinfo -give -me -info)
Zaoironfroggy_LT: Good to know.
kisielkironfroggy_LT: and they were trying to change the .stdin and .stdout attributes of a Popen object
lividand then it outputs multiple lines, each line has about 13 columns and at most 21 rows
ironfroggy_LTlivid: use subprocess, of course. that wouldnt even have anything to do with your stdin.
kisielkironfroggy_LT: that's not possible / right, is it?
lividironfroggy_LT, ok..I am pretty new to this. thanks. I will take a look at that
ironfroggy_LT: too used to bash/shell scripting ;)
ironfroggy_LTkisielk: ill bet it is. they are just file like objects.
kisielkironfroggy_LT: well, it didn't appear to be working
ironfroggy_LT: basically, they were doing Popen on two commands
ironfroggy_LT: and then taking the stdout from one and assigning it to the stdin of the other
which seemed... a bit wrong to me :)
ironfroggy_LTseems fine, more or less. i might of just told the shell to do it, but thats also not as portable.
but it doesnt seem like a great idea to make them pipe everything through your own app.
kisielkI thought using external pipes
would be the way to go
ironfroggy_LTbut you can give any filelike object as any of the pipes, so there isnt any reason it shouldnt work.
kisielkhm interesting
ironfroggy_LTas in pipes made with mkpipe?
kisielkI also didn't know if you could switch a process's stdin after the fact
ironfroggy_LTyou arent
kisielkno?
ironfroggy_LTstdin, stdout, and stderr are always the same. the only thing that changes is what something is doing outside the process.
kisielkhmmm
actionhelo notes ironfroggy's knack for both python and juggling
helonotes ironfroggy's knack for both python and juggling
ironfroggy_LTi tried juggling pythons. they got angry.
heloif only...
does l.append(l.pop()) move the first element to the end?

Page: 2 9 16 23 30 37 44 51 58 65 72 

IrcArchive

NY Lost Funds