Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'bug': 0.02; 'over,': 0.05; 'subject:Error': 0.05; 'imports': 0.07; 'python': 0.08; 'eclipse': 0.09; 'pydev,': 0.09; 'am,': 0.12; 'received:209.85.214.174': 0.13; '2.6,': 0.16; 'instantiated': 0.16; 'margin.': 0.16; 'msg,': 0.16; 'pydev': 0.16; 'shed': 0.16; 'subject:package': 0.16; 'subject:variable': 0.16; 'traceback.': 0.16; 'wished': 0.16; 'cc:addr:python-list': 0.16; 'wed,': 0.17; 'wrote:': 0.18; 'appears': 0.19; 'cheers,': 0.20; 'trying': 0.21; 'tracker': 0.21; 'maybe': 0.21; 'header:In-Reply-To:1': 0.22; 'feb': 0.22; 'precise': 0.23; 'ignore': 0.24; 'command': 0.24; 'module': 0.26; 'import': 0.27; 'variable': 0.28; "i'm": 0.28; 'message- id:@mail.gmail.com': 0.29; 'problem': 0.29; 'cc:addr:python.org': 0.29; 'sim': 0.30; 'error': 0.30; 'version': 0.32; 'attach': 0.32; 'thanks': 0.32; 'does': 0.32; 'modules': 0.32; 'idea': 0.32; 'causing': 0.34; 'follows:': 0.34; 'jason': 0.34; 'hi,': 0.34; 'icon': 0.34; 'light': 0.35; 'trouble': 0.35; 'project': 0.35; 'received:209.85.214': 0.36; 'cc:2**1': 0.36; 'issue': 0.37; 'run': 0.37; 'but': 0.37; 'received:google.com': 0.37; 'using': 0.37; 'another': 0.37; 'received:209.85': 0.38; 'some': 0.38; 'skip:\xa0 10': 0.39; 'subject:from': 0.39; 'received:209': 0.39; 'might': 0.40; 'simple': 0.61; 'your': 0.61; 'hope': 0.61; 'mouse': 0.67; 'exact': 0.68; '29,': 0.73; 'message?': 0.84; 'peter.': 0.84; 'beside': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=XjJ3l1J8hrKqaXOsv6Y1WafiXG6h1QpdncYDHLA2QPk=; b=yy+P6yBjxYP2ltMHnzkF7u/S578W16nRHgJy+mpjwdoPVS5laeUTLVshPceKmCCoX2 WSH2swi5gV6qjAFqgjlPxbjhAfi2DacxArA5BFEyNEKYIpMR3bdKXhy31hUafK7DwmHb iAY9QuMz0AVPrX2U5Z9iYqykbS/CD9+iZPOtjOusV5kYStNuriJ7Wk+tBNgz1agxebun O0++9C9jfwmSPNxeLXDYkwGlmCAwBoLHwhkx1VWUgvTgCzAVecVQY14UCTx3p5rEFgXq ehqwr3mlRWNxXSQXrTUnbL7ElwMFEKcuJ92S8iE9FyJTZmUcKqGd/RRaGAadsb6dSl+y TSJw== MIME-Version: 1.0 In-Reply-To: References: From: Fabio Zadrozny Date: Wed, 7 Mar 2012 07:38:49 -0300 Subject: Re: Error importing __init__ declared variable from another package To: Jason Veldicott Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: python-list@python.org, __peter__@web.de X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 59 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1331116752 news.xs4all.nl 6990 [2001:888:2000:d::a6]:43346 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:21314 On Wed, Feb 29, 2012 at 1:38 AM, Jason Veldicott wrote: >> > Hi, >> > >> > I have a simple configuration of modules as beneath, but an import err= or >> > is reported: >> > >> > /engine >> > =A0 =A0(__init__ is empty here) >> > =A0 =A0engine.py >> > /sim >> > =A0 =A0__init__.py >> > >> > >> > The module engine.py imports a variable instantiated in sim.__init__ a= s >> > follows: >> > >> > =A0 =A0from sim import var_name >> > =A0 =A0var_name.func() >> > >> > The following error messaged is received on the func() call above >> > (Eclipse >> > PyDev): >> > >> > "undefined variable from import: func" >> Are you rephrasing or is this really the error message? If so run your >> program again on the command-line. Then please cut and paste the error >> message together with the traceback. >> > Any idea why this is causing an error? >> What version of Python are you using? >> What does sim/__init__.py contain? > > > > Thanks Peter. > > I'm using Python 2.6, but it works at the command line. =A0The error only > appears in Eclipse as a red cross in the margin. =A0The exact error msg, = as > appears in a floating text caption on mouse over, is as I mentioned > (capitalised). > > Perhaps it is some issue in PyDev, maybe related to the version of Python > I'm using. > > I'm in the process of trying to solve another related import problem, and > wished to resolve this one in the hope that it might shed light on the > other.=A0But as it works beside the error icon appearing, I might just ig= nore > it and spare the trouble of precise identification of cause. Please report that as a bug in the PyDev sf tracker (please attach a sample project where this problem can be reproduced). Cheers, Fabio