List Info

Thread: Python app and UNIX commands




Python app and UNIX commands
user name
2006-03-31 20:17:49
Hello,

I have come up with an idea of an app that I would like to write using python but I need some guidance. 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? I have read most of Michael Dawsons book but unfortunately it doesn't have this kind of stuff. I have just bought Magnus Lie Hetland's book and just started going through it. Any other recommendations will be appreciated. Thanks.

Will
Python app and UNIX commands
user name
2006-03-31 20:33:12
> 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
    http://corepython.com

wesley.j.chun :: wescpy-at-gmail.com
cyberweb.consulting : silicon valley, ca
http://cyberwebconsulti
ng.com
_______________________________________________
Tutor maillist  -  Tutorpython.org
http://
mail.python.org/mailman/listinfo/tutor
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )