[Tutor] is there an equivalent to the 'commands' module for Win32 platforms (95,98,NT)?
Remco Gerlich
scarblac@pino.selwerd.nl
Mon, 21 May 2001 12:56:29 +0200
On 0, Karim Yaici <karimy@nipltd.com> wrote:
> Hi there,
> I'd like to run some python scripts from another a script. I was looking at
> the documentation this morning, and I found the 'command's module which
> ,unfortunately, runs only on POSIX platforms. how can run commands in a
> Win98 environment? Has anyone tried to do the same?
The commands module is mostly just a wrapper around os.popen, as far as I
know. You should be able to use os.system() to start a command, and
os.popen() to get output from the command. That last thing may be a bit
dodgy on Windows, I don't know about that.
> There is also a module called 'nt', no documentation available on this one
> ;-(...I don't see any difference between this module and 'system', do you?
You mean 'os'. 'nt' shouldn't be used directly, it's basically the same as
'os' - on Windows. 'os' is a wrapper around whatever platform-specific
module should be used.
Try
>>> import os
>>> print os.name
That should print 'nt' for you, meaning that the functions are taken from
the nt module - on my Linux system, it print posix, taking its functions
from there.
--
Remco Gerlich