Request for feedback on my first Python program

Scott Meyers Usenet at aristeia.com
Fri May 30 20:44:54 EDT 2003


Many thanks to everyone for their very helpful suggestions, many of which
I've incorporated.  I have a couple of additional little questions:
  - I'm used to a compiler complaining if I reference a variable without
    declaring it.  Python doesn't do this, nor can I find mention of some
    kind of warning mode that will cause it to do it.  I've also read a
    tiny little bit about pyChecker.  Is it common to use such tools, or do
    real Python programmers go bareback?
  - Is it better to get into the habit of (a) importing modules and using
    fully qualified names or (b) importing selective names from modules and
    using them without qualification?  That is, which is generally better?

      import sys               # a
      sys.exit(1)

      from sys import exit     # b
      exit(1)

Finally, my ultimate goal with this project is to read a list of file and
directory names from a file, create an archive (e.g., zip file) containing
copies of the specified files and directories, encrypt the archive, and ftp
it to a remote machine.  I've found libraries for working with zip files
and for doing ftping, but I didn't see any standard library for encryping a
file.  Is there one?  Also, a cursory glance at the zipfile module
documentation didn't reveal a way to add the contents of a directory
(recursively -- including all its subdirectories and files) to a zip file.
Did I overlook something?  I figure that if there's no way to do it, I can
always find a way to coax Python into invoking winzip or pkzip as an
external process, but I'm hoping I can do everything via Python libraries.

Again, thanks for all your help so far.  I welcome any comments you have on
how I should best approach this problem.

Scott




More information about the Python-list mailing list