Unix commands within Python code

Larry Bates lbates at swamisoft.com
Thu Jul 15 14:01:17 EDT 2004


Basic is os.system(), but there are also
several os.popen#() calls depending on if you
need to get output or set environment before
execution.

There are also many os. commands that can
do this without shelling out to the Unix
shell, in particular:

os.chmod(path, mode)


FYI,
Larry Bates
Syscon, Inc.


"Kory Wheatley" <wheakorypersonal at yahoo.com> wrote in message
news:mailman.447.1089914219.5135.python-list at python.org...
> Hi all,
>
> I've just started to learn Python and I have a
> question.
>
> What is the syntax to embed Unix commands, or call
> other programs within a Python script?
>
> for example I would like to use a system chmod unix
> command in the python script:
>
> chmod 666 /tmp/filename
>
> or call another script
>
> /home/mailman/bin/list_members facultynews
> >${DIR}facultynew
>
> I would appreciate if someone can send me the syntax,
> or if its even possible.
>
> --
> Kory Wheatley
>
>
>
> __________________________________
> Do you Yahoo!?
> New and Improved Yahoo! Mail - Send 10MB messages!
> http://promotions.yahoo.com/new_mail





More information about the Python-list mailing list