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


Groups > comp.lang.python > #19468

Re: import fails in non-interactive interpreter

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!cs.uu.nl!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <jeanpierreda@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.003
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'interpreter': 0.05; 'subject:fails': 0.07; 'python': 0.08; 'interpreter,': 0.09; 'situation,': 0.09; '25,': 0.12; 'cc:addr:python-list': 0.15; 'this:': 0.15; 'subject:import': 0.16; 'subject:non': 0.16; 'wrote:': 0.16; 'wed,': 0.17; 'jan': 0.19; 'cc:no real name:2**0': 0.21; 'header:In-Reply-To:1': 0.22; 'cc:2**0': 0.25; 'module': 0.26; 'pm,': 0.26; 'import': 0.27; 'not.': 0.28; 'message- id:@mail.gmail.com': 0.28; 'matches': 0.28; 'cc:addr:python.org': 0.29; '(and': 0.29; 'imported': 0.30; 'does': 0.32; 'modules': 0.32; 'source': 0.32; 'file.': 0.34; 'brian': 0.35; 'received:209.85.160.46': 0.35; 'received:mail- pw0-f46.google.com': 0.35; 'received:209.85.160': 0.35; 'regular': 0.35; 'run': 0.37; 'but': 0.37; 'received:google.com': 0.37; 'received:209.85': 0.38; 'received:209': 0.39; 'subject:: ': 0.39; 'under': 0.40; 'your': 0.61; 'to:name:brian': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=+SQ1FU54FD7KHojnhc0Ri+7DzHUhqEtN1crHZSaCmA4=; b=vsVZYVR4OaUJrgnnJ8N+uxSM01eDvKoa7c1MH3E11JZjoRs6Cz7PTOltsw4JUHZG/Y PvEdL79fxUQufv9zVtfhiuYqbMikZ5FsSwHCaL0bSzmBOZJ76yNEAbjkLRH0yFKHPDIW obccjOUl4eoh64C8wymEikGnKFO9jM3VjXyhw=
MIME-Version 1.0
In-Reply-To <9115def9-c2f6-4ac9-ae4b-8b1b8867ba7b@c21g2000yqi.googlegroups.com>
References <9115def9-c2f6-4ac9-ae4b-8b1b8867ba7b@c21g2000yqi.googlegroups.com>
From Devin Jeanpierre <jeanpierreda@gmail.com>
Date Wed, 25 Jan 2012 22:04:53 -0500
Subject Re: import fails in non-interactive interpreter
To Brian <brian.brinegar@gmail.com>
Content-Type text/plain; charset=UTF-8
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.5109.1327547136.27778.python-list@python.org> (permalink)
Lines 13
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1327547136 news.xs4all.nl 6917 [2001:888:2000:d::a6]:59990
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:19468

Show key headers only | 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