Antoon Pardon <[EMAIL PROTECTED]> writes: > On 2007-04-27, James Stroud <[EMAIL PROTECTED]> wrote: > > Rajesh wrote: > >> Hi, > >> > >> The '-I<path>' option adds the path to the list of directories that > >> contains modules that can be included in a script. I can use it as "#!/ > >> usr/bin/perl -I<path_to_my_modules>" thereby not asking the user of > >> the script to set the <path_to_my_modules> in their environment. > >> > >> Is there any equivalent command-line option to the python binary or a > >> command-line version of PYTHONPATH? > >> > >> Regards > >> Rajesh > > > > Why not just modify sys.path within the actual script? > > Maybe because he has multiple versions of modules he wants to test his > script against. > > -- > Antoon Pardon
Here are some approaches we've used: 1. Write a small script which sets PYTHONPATH and then calls the app. Make a different script for each setup you need. 2. Use a small script to set a couple of envvars, which in turn are used to find the right config file, which has all the config decisions you want. archtool_path= os.getenv('ARCHTOOL_PATH') archtool_cfg = os.getenv('ARCHTOOL_CFG') sys.path.insert(0,archtool_path) import archtool exec "import archtool.%s as cfg" % archtool_cfg -- Harry George PLM Engineering Architecture -- http://mail.python.org/mailman/listinfo/python-list