Get Path of current Script
John Gordon
gordon at panix.com
Mon Mar 14 16:12:13 EDT 2011
In <5520ec67-bc4e-4f81-b27a-cf1f8c8deacd at v11g2000prb.googlegroups.com> Alexander Schatten <aschatt at gmail.com> writes:
> I mean, this is something very common: you write a program or a script
> and want to load some configuration data.
There are several good ways to do it:
+ Assume the config file is in the current directory (crude, but it can
work)
+ Put the config file in a known location (i.e. /etc/foorc, ~/.foorc)
+ Put the location of the config file in an environment variable
+ As part of your application's install process, ask the user where the
config file will be stored, and record their answer
--
John Gordon A is for Amy, who fell down the stairs
gordon at panix.com B is for Basil, assaulted by bears
-- Edward Gorey, "The Gashlycrumb Tinies"
More information about the Python-list
mailing list