"Fredrik Lundh" <[EMAIL PROTECTED]> writes:
> since you know the name of the config file you're looking for, you can
> simplify (and unweirdify) your code a bit by changing your config file to
> look like this:
>
> # File: config.py
>
> #
> # configuration defaults
>
> some_param
Burton Samograd wrote:
> A reply to my own question, but I thought I would share the answer. I
> got it to work with the following code:
>
> import config
> import sys
> from posix import environ
> sys.path.insert(0, environ["HOME"]+"/.program")
> reload(config)
>
> I have a file in my working di
Burton Samograd <[EMAIL PROTECTED]> writes:
> Is there a way to create a module namespace and populate it
> before sourcing the file?
A reply to my own question, but I thought I would share the answer. I
got it to work with the following code:
import config
import sys
from posix
Burton Samograd wrote:
> My question is, how can I setup my program defaults so that they can
> be overwritten by the configuration variables in the user file (and so
> I don't have to scatter default values all over my code in try/catch
> blocks)?
The Django web framework happens to do something
Burton Samograd wrote:
> Hi,
>
> I'm writing an app that stores some user configuration variables in a
> file ~/.program/config, which it then imports like so:
>
> import sys
> from posix import environ
> sys.path.append(environ["HOME"]+"/.program")
> impor
Burton Samograd wrote:
> Hi,
>
> I'm writing an app that stores some user configuration variables in a
> file ~/.program/config, which it then imports like so:
>
> import sys
> from posix import environ
> sys.path.append(environ["HOME"]+"/.program")
> import confi
Hi,
I'm writing an app that stores some user configuration variables in a
file ~/.program/config, which it then imports like so:
import sys
from posix import environ
sys.path.append(environ["HOME"]+"/.program")
import config
I can then access the configuration th