Kent, Yes, your example does work. So did os.popen...however, the problem is specific to "cmd.exe". Have you tried that yet?
Thanks! Kent Johnson wrote: > jas wrote: > > Ok, I tried this... > > > > C:\>python > > Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] > > on win32 > > Type "help", "copyright", "credits" or "license" for more information. > > > >>>>import subprocess as sp > >>>>p = sp.Popen("cmd", stdout=sp.PIPE) > >>>> > >>>>result = p.communicate("ipconfig") > > > > 'result' is not recognized as an internal or external command, > > operable program or batch file. > > > > > > > > basically I was opening to send the "ipconfig" command to cmd.exe and > > store the result in the "result" variable. But you can see there was > > an error with result. > > This works for me: > import subprocess as sp > p = sp.Popen("ipconfig", stdout=sp.PIPE) > result = p.communicate()[0] > print result > > Kent -- http://mail.python.org/mailman/listinfo/python-list