command-line args

Tim Daneliuk tundra at tundraware.com
Sat Apr 24 20:30:08 EDT 2004


Michael wrote:

> What's the perfered method of passing command-line args throughout a 
> Python program given that globals don't seem to really exist? I thought 
> of writing them out to a python file and then importing them when 
> needed.. but that seems like it'd only work for a single process.. not 
> in instances where more than one user is running the program. There 
> isn't anything like a virtual file space that could be used for this? 
> Anyway to set a global variable?
> 

If I may be so immodest, I have just released this as another way
to set program options:

    http://www.tundraware.com/Software/tconfpy/

Keep your options in a text file with each option in the form:

option = value

Call tconfpy.ParseConfig("myconfigfile") and you'll get back
(among other things) a populated symbol table with each option as
one of the keys...

-- 
----------------------------------------------------------------------------
Tim Daneliuk     tundra at tundraware.com
PGP Key:         http://www.tundraware.com/PGP/



More information about the Python-list mailing list