Allen Fowler wrote:
FWIW:
When using relative paths I got extra ../../ terms, so I changed
join_relative() to:
def join_relative(base, path):
return os.path.normpath(os.path.join(script_dir(base), path))
Seems to work...
Yeah, good catch ... looks great, and thanks for sharing
FWIW:
When using relative paths I got extra ../../ terms, so I changed
join_relative() to:
def join_relative(base, path):
return os.path.normpath(os.path.join(script_dir(base), path))
Seems to work...
Yeah, good catch ... looks great, and thanks for sharing
Allen Fowler wrote:
What is the recommended way to configure my application find the various
database and/or configuration files it needs?
Recommemded by whom? A lot depends on the OS. Apple for example have one set of
recommendations for MacOS, Windows has another and Linux has
Allen Fowler wrote:
What is the recommended way to configure my application find the various
database and/or configuration files it needs?
Recommemded by whom? A lot depends on the OS. Apple for example have one set
of
recommendations for MacOS, Windows has another and Linux has
Allen Fowler wrote:
snip
As a follow-up question, how do give my modules stored under ./lib access to
the data in my ConfigParser object? (For instance, database connection
string, storage path, etc.)
I guess a global ConfigParser object would work, but that seems wrong.
And yet,
Assuming the application could be invoked in odd ways that may alter the
notion of the current working directory, how do I unambiguously find the
absolute path to the current python source file? (So I can load the nearby
.ini)
I use a helper function that calculates the absolute
Martin Walsh mwa...@mwalsh.org
Allen Fowler wrote:
As a follow-up question, how do give my modules stored under ./lib access
to
the data in my ConfigParser object? (For instance, database connection
string,
storage path, etc.)
I guess a global ConfigParser object
Something like this ...
# lib/mypaths.py
# --
import os
def script_path(base):
return os.path.realpath(os.path.abspath(base))
def script_dir(base):
return os.path.dirname(script_path(base))
def join_relative(base, path):
return
Allen Fowler allen.fow...@yahoo.com wrote
For an object that needs many settings, what about passing
in an instance of ConfigParser? (Or should I extract the
settings to a dict, first?)
Personally I usually extract an ini type settings to either global
variables or an object or a dict at
Allen Fowler wrote:
Something like this ...
# lib/mypaths.py
# --
import os
def script_path(base):
return os.path.realpath(os.path.abspath(base))
def script_dir(base):
return os.path.dirname(script_path(base))
def join_relative(base, path):
return
Allen Fowler wrote:
Martin Walsh mwa...@mwalsh.org
Allen Fowler wrote:
As a follow-up question, how do give my modules stored under ./lib access
to
the data in my ConfigParser object? (For instance, database connection
string,
storage path, etc.)
I guess a global ConfigParser
Hello,
What is the recommended way to configure my application find the various
database and/or configuration files it needs?
For instance my folder layout:
/path_to_app/app.py
/path_to_app/lib/
/path_to_app/database/
/path_to_app/config/
/path_to_app/photos
and so on. (app.py being
Allen Fowler allen.fow...@yahoo.com wrote
What is the recommended way to configure my application
find the various database and/or configuration files it needs?
Recommemded by whom? A lot depends on the OS. Apple for
example have one set of recommendations for MacOS, Windows
has another and
What is the recommended way to configure my application find the various
database and/or configuration files it needs?
Recommemded by whom? A lot depends on the OS. Apple for example have one set
of
recommendations for MacOS, Windows has another and Linux has several to
choose
14 matches
Mail list logo