[Zope] Python script problem

Dieter Maurer dieter@handshake.de
Sun, 11 Aug 2002 19:51:17 +0200


List Subscriber @ Neurobs writes:
 > I am trying to call 'zip'(linux) from within my python external method. 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.
Unix processes want an additional "argument 0" which by default is
the name of the program file.

Try:

   result = os.spawnl(os.P_WAIT,cmd_path,'zip','-rv',zip_file_name,'.')



Dieter