#python - Thu 1 Mar 2007 between 06:29 and 06:39

NY Lost Funds



triplah_silwol: use the subprocess module
bah :)
sirlark: int()
:)
if they about hex etc
i know, i know, thats a lame one :(
sirlarksilwol: output = `shell command`
note the back quotes
triplah_ : radix conversion would actually be pretty cool
thanks
silwolhmm, the backquotes don't seem to work
polpakeh
silwoli get 'invalid syntax'
polpakno, that's not how you do that
sirlarksilwol: http://docs.python.org/lib/node535.html
polpak:
the documentation (link formerly provided) would seem to indicate that it SHOULD work, or at least should have worked in some or other previous version
silwolthanks sirlark, that seems to do the job for me
polpaksirlark: indeed. but we use subprocess now
actionVornicus didn't know that ever worked.
Vornicusdidn't know that ever worked.
Fonthi:)
actionsilwol knows this from php
silwolknows this from php
sirlarkpolpak: Vornicus: actually, come to think, I've never got it work either
silwol: np
actually I rpefer the backquotes thing, it really makes the programmers life easier
polpakeh
no it doesn't
triplah_how does it make it easier?
polpakapart from less typing
triplah_what if you want to redirect to a file? or another process?
polpakor not read all the output at once
or get stderr as well
triplah_yeah
sirlarkpolpak: in the case where I just want to run a shell command and capture it's output to a string, once off (e.g. interface = `/sbin/ifconfig` ... is a lot easier than the subprocess method) [assuming that is how backquotes are meant to work in python]
polpaksirlark: well if you have that case come up often, make your own function to do what you want (using the subprocess module) and call that
triplah_sirlark: the subprocess module was designed so there was a single good way to do that stuff
a unified api if you will
silwolokay, one more question... how do i get the return value then?
triplah_2.6.20 ck sources downloading
oooo yeah

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

IrcArchive

NY Lost Funds