[Tutor] Python app and UNIX commands

w chun wescpy at gmail.com
Fri Mar 31 22:33:12 CEST 2006

> I would like to write an app for Linux/Unix
> that fetches a gzipped or bzipped file from a remote server by http or ftp.
> The file will be downloaded to a temporary directory, unzipped and its
> contents copied to specific directory. If the process has gone well, the
> files in the temporary directory are cleaned up. To do this, I guess I would
> have to mingle python with some UNIX commands. How do I intermingle python
> and unix commands?

hi will,

you can do it all in python... no unix at all!  check out the Python
Library Reference for docs on these modules which you'll be using:

- urllib (downloading via HTTP or FTP)
- tempfile (creating a temp dir for the work)
- gzip and bz2 (for processing gzipped or bzipped files)
- os and os.path (for file-related moving, copying, deleting)

there may be one or two more, but i think you can do it with just
these four as long as you do not have to run other Unix cmds (and/or
need to send input or receive output from them).

good luck!
-- wesley
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"Core Python Programming", Prentice Hall, (c)2007,2001

wesley.j.chun :: wescpy-at-gmail.com
cyberweb.consulting : silicon valley, ca

More information about the Tutor mailing list