On Wed, Nov 19, 2008 at 12:02 PM, Simon King <[EMAIL PROTECTED]> wrote: > > Sorry for replying to myself, but I also have a follow-up question. > > On Nov 19, 1:40 pm, Simon King <[EMAIL PROTECTED]> wrote: >> How can I do the same thing when I am in Sage, using the following >> variables? > > Meanwhile I learned that os.system can do those things. > > Next question: I also need to know the contents of the archive. Using > tar in Linux: > tar -tzf file.tar.gz > which lists the archived file names. > > When I do > sage: os.system('tar -tzf file.tar.gz') > then the list of file names appears on the screen, but it is not > returned as a string.
Is this platform independent?? http://www.python.org/doc/2.5.2/lib/module-tarfile.html and/or http://mail.python.org/pipermail/python-list/2001-December/118010.html might help. > > Is there a direct way to get the list of file names into Sage? I only > know the following clumsy work-around: > sage: os.system('tar -tzf file.tar.gz > tmpfile') > sage: f = file('tmpfile','r') > sage: L = f.read().split('\n') > >> Moreover, it should be platform independent. > > This still is a concern for me. Would the above be acceptable for the > Windows/VMWare or OS X versions of Sage, or what else should I do? > > Cheers, > Simon > > > > --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---