Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #82172 > unrolled thread

Re: module import questions and question about pytest and module imports

Started byIan Kelly <ian.g.kelly@gmail.com>
First post2014-12-08 19:22 -0700
Last post2014-12-08 19:22 -0700
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: module import questions and question about pytest and module imports Ian Kelly <ian.g.kelly@gmail.com> - 2014-12-08 19:22 -0700

#82172 — Re: module import questions and question about pytest and module imports

FromIan Kelly <ian.g.kelly@gmail.com>
Date2014-12-08 19:22 -0700
SubjectRe: module import questions and question about pytest and module imports
Message-ID<mailman.16756.1418091788.18130.python-list@python.org>

[Multipart message — attachments visible in raw view] — view raw

On Sun, Dec 7, 2014 at 9:50 AM, sam pendleton <samp4040@gmail.com> wrote:
> Having to put the garage package on the sys.path seems a little off,
> why wouldn't relative imports work?

Relative imports are relative to a package's hierarchy of namespaces, not
relative to the file system. As such, you can't perform a relative import
of a module that isn't in the same top-level package (and besides this, the
import statement that you posted was an absolute import anyway).

All top-level packages have to be on sys.path, or the import system won't
be able to find them.

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web