os.shell, recursion, encryption

Gordon McMillan gmcm at hypernet.com
Mon Feb 14 16:46:30 CET 2000

55555 wrote:

> I'm spawning pkzip for dos using os.shell() because I would like to use the encryption 
> feature.  As far as I can tell that is not available in the gzip library and the 
> documentation on the cryptography toolbox didn't give me the impression that all the bugs 
> were worked out.  Does anyone know whether that has changed?

1) You must mean os.system
2) What cryptography toolbox? There are a number of them.

> Anyway, os.shell() pops up a new dos box for each call.  I'm using os.path.walk() and 
> making a lot of calls to the zip program.  I'm wondering if there is a way to not spawn 
> 40 windows.  0 windows would be ideal.

You probably want os.spawnv.
> Finally, I'm wondering if there is a way to attach to a global variable while moving 
> around with os.path.walk()?  I understand recursion and have read Python's scope rules 
> but I can't seem to either pass local varaibles through or to attach to a global 
> variable.

Yes, you can use a global var, as long as your callback uses 
"global". It might be better to use a mutable arg as the user 
arg to os.path.walk - say, a list.

- Gordon

More information about the Python-list mailing list