Re: paths in modules

2007-02-22 Thread Brandon Mintern
On Thu, 22 Feb 2007 10:30:59 -0600, Larry Bates wrote: > Normally this would be: > > f = os.popen('./wrapper_dir/utility_dir/some_external_utility') > > -Larry Yes, but the problem with that solution is, let's say that I further abstract the whole thing and I add a directory outside of my toplev

Re: paths in modules (solved)

2007-02-22 Thread Brandon Mintern
On Thu, 22 Feb 2007 08:28:50 -0800, Paul Boddie wrote: > And you really want to refer to utility_dir relative to some_wrapper. > What you can try is to split the __file__ attribute of some_wrapper - > it's a standard attribute on imported modules - in order to refer to > the module's parent directo

Re: paths in modules

2007-02-22 Thread Larry Bates
Brandon Mintern wrote: > I am developing a project in Python which uses several external utilities. > For convenience, I am wrapping these accesses in a module. The problem is > that I cannot be sure where these modules are imported from, so I am > trying to figure out how to reliably execute e.g.

Re: paths in modules

2007-02-22 Thread Paul Boddie
On 22 Feb, 17:13, Brandon Mintern <[EMAIL PROTECTED]> wrote: > > toplevel_dir > +-main script > +-wrapper_dir > +-some_wrapper > +-utility_dir > +-some_external_utility [...] > And then in some_wrapper, I would have code like: > > import os > > def use_external_utility(): > f = os.popen

Re: paths in modules

2007-02-22 Thread Brandon Mintern
On Thu, 22 Feb 2007 11:13:46 -0500, Brandon Mintern wrote: > Of course, the problem with that approach is that it fails because there > is no utility_dir in the CWD... ...and of course by CWD, I actually mean "current working directory", which should have actually been PWD or "present working dire

paths in modules

2007-02-22 Thread Brandon Mintern
I am developing a project in Python which uses several external utilities. For convenience, I am wrapping these accesses in a module. The problem is that I cannot be sure where these modules are imported from, so I am trying to figure out how to reliably execute e.g. a popen call. Example layout: