Alan Isaac <[EMAIL PROTECTED]> wrote:

> "Alex Martelli" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > To me, it makes sense: if a module is top-level, and thus not part of a
> > package (and __main__ in particular is always in that state), then
> > saying "import from the current package" has no well defined meaning,
> > because there IS no "current package".
> 
> Thanks for the explanations.
> I do not have an opinion because I have not really thought this through.
> 
> One of the things I was hoping for, however, was for a less hackish way
> for scripts bundled with a package to access the package modules.
> 
> That is, suppose I have directory ``mypackage`` with subdirectory
> ``scripts``.
> What is the pretty way for the scripts to access ``mypackage`` without
> assuming ``mypackage`` is in ``sys.path``?

I don't know of any "pretty" way -- I'd do it by path manipulation
(finding mypackage from os.path.abspath(__file__) and inserting its
_parent_ directory in sys.path).


Alex
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to