Re: import from containing folder

2006-07-26 Thread Simon Forman
David Isaac wrote: > Alan wrote: > > I do not want to make any assumptions about > > this particular package being on sys.path. > > (I want a relative import, but cannot assume 2.5.) > > > I should mention that to get around this I have > been using > sys.path.append(os.path.split(sys.argv[0])[0])

Re: import from containing folder

2006-07-26 Thread David Isaac
Alan wrote: > I do not want to make any assumptions about > this particular package being on sys.path. > (I want a relative import, but cannot assume 2.5.) I should mention that to get around this I have been using sys.path.append(os.path.split(sys.argv[0])[0]) in the script I care most about. I

Re: import from containing folder

2006-07-26 Thread David Isaac
Simon Forman wrote: > I would assume (but I haven't checked) that this should work as long as > delmepy (in your case PackageFolder) was somewhere on sys.path. Sorry that was not clear: I do not want to make any assumptions about this particular package being on sys.path. (I want a relative import

Re: import from containing folder

2006-07-26 Thread Simon Forman
David Isaac wrote: > Suppose I have inherited the structure > > PackageFolder/ > __init__.py > mod1.py > mod2.py > SubPackageFolder/ > __init__.py > mod3.py > > and mod3.py should really use a function in mod2.py. > *Prior* to Python 2.5, what is

import from containing folder

2006-07-26 Thread David Isaac
Suppose I have inherited the structure PackageFolder/ __init__.py mod1.py mod2.py SubPackageFolder/ __init__.py mod3.py and mod3.py should really use a function in mod2.py. *Prior* to Python 2.5, what is the best way to access that? (Please assu