Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Python

commands module for windows

 

 

Python python RSS feed   Index | Next | Previous | View Threaded


tomanishkb at gmail

Dec 1, 2009, 10:05 PM

Post #1 of 5 (352 views)
Permalink
commands module for windows

Dear all,

Is there any python module for windows which is equivalent to commands
module in linux?


--
thanks & regards,

Maneesh KB


clp2 at rebertia

Dec 1, 2009, 10:12 PM

Post #2 of 5 (325 views)
Permalink
Re: commands module for windows [In reply to]

On Tue, Dec 1, 2009 at 10:05 PM, M Kumar <tomanishkb [at] gmail> wrote:
> Is there any python module for windows which is equivalent to commands
> module in linux?

`subprocess` should work: http://docs.python.org/library/subprocess.html

The `commands` docs even say:
"The subprocess module provides more powerful facilities for spawning
new processes and retrieving their results.
Using the subprocess module is preferable to using the commands module."

Cheers,
Chris
--
http://blog.rebertia.com
--
http://mail.python.org/mailman/listinfo/python-list


tomanishkb at gmail

Dec 1, 2009, 10:34 PM

Post #3 of 5 (321 views)
Permalink
Re: commands module for windows [In reply to]

can I use this module to store output to a python variable?
I am looking for something similar to
commands.getoutput("<cmd>")

On Wed, Dec 2, 2009 at 11:42 AM, Chris Rebert <clp2 [at] rebertia> wrote:

> On Tue, Dec 1, 2009 at 10:05 PM, M Kumar <tomanishkb [at] gmail> wrote:
> > Is there any python module for windows which is equivalent to commands
> > module in linux?
>
> `subprocess` should work: http://docs.python.org/library/subprocess.html
>
> The `commands` docs even say:
> "The subprocess module provides more powerful facilities for spawning
> new processes and retrieving their results.
> Using the subprocess module is preferable to using the commands module."
>
> Cheers,
> Chris
> --
> http://blog.rebertia.com
>



--
thanks & regards,

Maneesh KB
Sent from Delhi, DL, India


clp2 at rebertia

Dec 1, 2009, 10:40 PM

Post #4 of 5 (319 views)
Permalink
Re: commands module for windows [In reply to]

> On Wed, Dec 2, 2009 at 11:42 AM, Chris Rebert <clp2 [at] rebertia> wrote:
>> On Tue, Dec 1, 2009 at 10:05 PM, M Kumar <tomanishkb [at] gmail> wrote:
>> > Is there any python module for windows which is equivalent to commands
>> > module in linux?
>>
>> `subprocess` should work: http://docs.python.org/library/subprocess.html
>>
>> The `commands` docs even say:
>> "The subprocess module provides more powerful facilities for spawning
>> new processes and retrieving their results.
>> Using the subprocess module is preferable to using the commands module."

On Tue, Dec 1, 2009 at 10:34 PM, M Kumar <tomanishkb [at] gmail> wrote:
> can I use this module to store output to a python variable?
> I am looking for something similar to
> commands.getoutput("<cmd>")

Yes, of course it can. If it's more powerful, then it can do
everything the other module can.
It'd be silly for the `commands` docs to point people to `subprocess`
if this wasn't the case.
It will take more than a single line of code though. Read the module's docs.

Regards,
Chris
--
http://blog.rebertia.com
--
http://mail.python.org/mailman/listinfo/python-list


tomanishkb at gmail

Dec 1, 2009, 10:46 PM

Post #5 of 5 (317 views)
Permalink
Re: commands module for windows [In reply to]

thank you very much Chris :)

On Wed, Dec 2, 2009 at 12:10 PM, Chris Rebert <clp2 [at] rebertia> wrote:

> > On Wed, Dec 2, 2009 at 11:42 AM, Chris Rebert <clp2 [at] rebertia> wrote:
> >> On Tue, Dec 1, 2009 at 10:05 PM, M Kumar <tomanishkb [at] gmail> wrote:
> >> > Is there any python module for windows which is equivalent to commands
> >> > module in linux?
> >>
> >> `subprocess` should work:
> http://docs.python.org/library/subprocess.html
> >>
> >> The `commands` docs even say:
> >> "The subprocess module provides more powerful facilities for spawning
> >> new processes and retrieving their results.
> >> Using the subprocess module is preferable to using the commands module."
>
> On Tue, Dec 1, 2009 at 10:34 PM, M Kumar <tomanishkb [at] gmail> wrote:
> > can I use this module to store output to a python variable?
> > I am looking for something similar to
> > commands.getoutput("<cmd>")
>
> Yes, of course it can. If it's more powerful, then it can do
> everything the other module can.
> It'd be silly for the `commands` docs to point people to `subprocess`
> if this wasn't the case.
> It will take more than a single line of code though. Read the module's
> docs.
>
> Regards,
> Chris
> --
> http://blog.rebertia.com
>



--
thanks & regards,

Maneesh KB
Sent from Delhi, DL, India

Python python RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.