"Rance Hall" <ran...@gmail.com> wrote
osname = os.name pathtocfg = os.path.dirname(sys.argv[0]) configfileloc = os.path.abspath(pathtocfg) os.chdir(configfileloc) to set the directory of all subsequent file lookups in a script.
This is not the most user friendly thing to do. Some sys admins require config files (and indeed all data) to be located separately from programs. It would be more friendly to provide the option of defining the config file location, perhaps via an environment variable. Of course if the env variable is not defined you probably still need this code for the default location, in which case Wayne's suggestion should work. (Alternatively throw an error insisting the EV be set up) And if you are not deploying this to more than one operating envioronment where you know the policy then its a moot point anyway. Alan G. Back from his vacation :-) _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor