[Tutor] Hi, need help on zip commands for windows

Luke Paireepinart rabidpoobear at gmail.com
Thu Jul 13 05:24:37 CEST 2006


Ramakrishnan, Shashikanth wrote:
>
> Hi,
>
Hi.
>
> I have just started using Python and would appreciate if somebody 
> could help me out on zip commands.
>
> I am using C H Swaroop’s book “A byte of python” as my beginners guide.
>
> One example states to use >>>zip_command = "zip -qr '%s' %s" % 
> (target, ' '.join(source))
>
> for zipping the target and source.
>
> However, “zip_command” as I understand is for Linux.
>
You're right.
I assume later in the example he uses a method from the 'os' module to 
run this command?
>
> What would be the quivalent command for windows( I am using IDLE 
> 1.1.3, Python version 2.4.3)
>
Well, the example you gave would work on Windows if you had a zipping 
program in your PATH environment variable
called 'zip' that took the same arguments as the 'zip' command on Linux.
This is probably not likely, however, so you have three routes as I see it.
1. look into zipping files with the 'zlib' library.
2. find a port of the linux 'zip' program and put it in the same 
directory as your program (or add it to PATH).
3. find a different command-line zipping program and change zip_command 
to add the correct arguments to it.

HTH,
-Luke
>
> Really appreciate your help.
>
> Thanks,
>
> Shashi.
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>   



More information about the Tutor mailing list