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


Groups > comp.lang.python > #19468

Re: import fails in non-interactive interpreter

References <9115def9-c2f6-4ac9-ae4b-8b1b8867ba7b@c21g2000yqi.googlegroups.com>
From Devin Jeanpierre <jeanpierreda@gmail.com>
Date 2012-01-25 22:04 -0500
Subject Re: import fails in non-interactive interpreter
Newsgroups comp.lang.python
Message-ID <mailman.5109.1327547136.27778.python-list@python.org> (permalink)

Show all headers | View raw


On Wed, Jan 25, 2012 at 9:25 PM, Brian <brian.brinegar@gmail.com> wrote:
> Under what situations would a module be available to through the
> interactive interpreter but not the non-interactive?

I don't know if it matches your situation, but one such case is this:

The interactive interpreter (and the interpreter with the -c flag) add
the current working directory ('') to the module import search path
(sys.path). Regular python execution does not. So modules in the
current working directory can always be imported from the interactive
interpreter, but not necessarily if you run python on a source file.

-- Devin

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

import fails in non-interactive interpreter Brian <brian.brinegar@gmail.com> - 2012-01-25 18:25 -0800
  Re: import fails in non-interactive interpreter Devin Jeanpierre <jeanpierreda@gmail.com> - 2012-01-25 22:04 -0500
  Re: import fails in non-interactive interpreter Jean-Michel Pichavant <jeanmichel@sequans.com> - 2012-01-26 11:58 +0100
  Re: import fails in non-interactive interpreter Brian Brinegar <brian.brinegar@gmail.com> - 2012-01-26 07:47 -0500
  Re: import fails in non-interactive interpreter Jean-Michel Pichavant <jeanmichel@sequans.com> - 2012-01-26 14:49 +0100
  Re: import fails in non-interactive interpreter Brian Brinegar <brian.brinegar@gmail.com> - 2012-01-26 09:37 -0500

csiph-web