os.spawnl and zip on linux

A M aseem at neurobs.com
Sat Aug 10 23:52:42 CEST 2002


Hi,
I am trying to call 'zip'(linux) from within my python code. The is
what I do:

### SRC ###

import os

src_dir = 'some_dir'
cmd_apth = '/usr/bin/zip'
zip_file_name = 'res.zip'

os.chdir(src_dir)
result = os.spawnl(os.P_WAIT,cmd_path,'-rv',zip_file_name,'.')
print result

### END SRC ###

the result is always 12 (zip error: Nothing to do). zip creates the
directory structures in the zip file but does not put in the actual
files.

Now if I do an os.system instead of an os.spawnl it works, however I
do not want to use and cannot use os.system for application reasons.

What is going on here?? 
Also I have been able to use 'unzip'(Linux) in the same manner without
a hitch.

So what am I doing wrong here?? Why shouldnt it work??

TIA
AM



More information about the Python-list mailing list