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


Groups > comp.lang.python > #25845

Re: python package confusion

Path csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <d@davea.name>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.025
X-Spam-Evidence '*H*': 0.95; '*S*': 0.00; 'source.': 0.05; 'executable': 0.07; 'python': 0.09; 'nameerror:': 0.09; 'wrong,': 0.09; 'cc:addr:python-list': 0.10; 'def': 0.10; 'subject:python': 0.11; 'files.': 0.13; '/usr/bin/env': 0.16; '610': 0.16; 'wrote:': 0.17; '>>>': 0.18; 'module': 0.19; 'trying': 0.21; 'import': 0.21; 'defined': 0.22; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header :User-Agent:1': 0.26; '(most': 0.27; 'am,': 0.27; 'run': 0.28; 'source': 0.29; "i'm": 0.29; 'error': 0.30; 'stuff': 0.30; 'file': 0.32; 'traceback': 0.33; 'skip:- 20': 0.34; 'skip:l 30': 0.35; 'test': 0.36; 'two': 0.37; 'subject:: ': 0.38; 'shows': 0.38; 'received:192': 0.39; 'received:192.168': 0.40; 'series': 0.63; 'more': 0.63; 'jul': 0.65; 'header:Reply-To:1': 0.68; 'received:74.208': 0.71; 'reply-to:no real name:2**0': 0.72; '144': 0.84; 'pasting': 0.84; 'received:74.208.4.194': 0.84; 'fibonacci': 0.91; 'kat': 0.91; 'skip:/ 30': 0.91; 'cutting': 0.93
Date Mon, 23 Jul 2012 06:19:26 -0400
From Dave Angel <d@davea.name>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120714 Thunderbird/14.0
MIME-Version 1.0
To Lipska the Kat <lipska@lipskathekat.com>
Subject Re: python package confusion
References <BsCdnb3NJ_bOvJDNnZ2dnUVZ7rmdnZ2d@bt.com>
In-Reply-To <BsCdnb3NJ_bOvJDNnZ2dnUVZ7rmdnZ2d@bt.com>
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding 7bit
X-Provags-ID V02:K0:Tu1/ll/ojvKuv5kP71c0UDSOGhZHYHZ12/r4qCq4oRn RnCwAUSi/wODnYZ1MDrPmd5KzJXJhZWRG4nSP2ACVJUMh1vdbu EuQ29+nBWgDsQth4ca8yWHOw9KnTQcyBDmr4QnPpxZ+A8/6Q8H ja/8DfUP6gVXDPNDmDFBMpJa11o77YUsS0JI/vkSk9I7Ez72LM n+c7/i5lGq2JJ0MovqX7zwgLmVeddL7fhsw3/MZYM3Fx0N26GB tzL3NDnGdTPcLT+GCqZYZZLhNAhq9NCDLpvBe5S2yqDDq9uGwn NRiSVWz7IENeMd62L/p0fKHIYe8FHBnGIQ0Ecp1B37olEjpsw= =
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
Reply-To d@davea.name
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.2457.1343038791.4697.python-list@python.org> (permalink)
Lines 69
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1343038791 news.xs4all.nl 6916 [2001:888:2000:d::a6]:41498
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:25845

Show key headers only | View raw


On 07/23/2012 06:02 AM, Lipska the Kat wrote:
> Hello again pythoners
>
> I'm trying to understand the python package stuff
>
> I have the following directory
>
> /home/lipska/python/dev/mods
>
> In this directory I have two files, both executable
>
> ----------------------
>
> #! /usr/bin/env python3.2
>
> # fibo.py Fibonacci numbers module
>
> def fib(n):    # write Fibonacci series up to n
>     a, b = 0, 1
>     while b < n:
>         print(b, end=' ')
>         a, b = b, a+b
>     print()
>
> ----------------------
>
> #! /usr/bin/env python3.2
>
> # test.py fibo module test program
>
> import fibo
>
> fibo.fib(1000)
>
> -----------------------
>
> The PYTHONPATH ev is set to /home/lipska/python/dev/mods:.
> in .bashrc
>
> The following interactive session works thusly
>
> lipska@ubuntu:~/python/dev/mods$ python3.2
> Python 3.2.3 (default, Jul 17 2012, 14:23:10)
> [GCC 4.6.3] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import fibo
> >>> fibo.fib(1000)
> 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987
> >>>
>
> However if I try and run test.py as an executable I get the following
> error
>
> lipska@ubuntu:~/python/dev/mods$ test.py
> Traceback (most recent call last):
>   File "./test.py", line 5, in <module>
>     fib(1000)
> NameError: name 'fib' is not defined
>

That line isn't the way you showed it in the source.  You showed us
source as  fibo.fib(1000), and the error message shows it as fib(1000)

So you're either cutting & pasting wrong, or you have two test.py files.

-- 

DaveA

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


Thread

python package confusion Lipska the Kat <lipska@lipskathekat.com> - 2012-07-23 11:02 +0100
  Re: python package confusion Dave Angel <d@davea.name> - 2012-07-23 06:19 -0400
    Re: python package confusion Lipska the Kat <lipska@lipskathekat.com> - 2012-07-23 11:54 +0100
  Re: python package confusion Devin Jeanpierre <jeanpierreda@gmail.com> - 2012-07-23 06:22 -0400
    Re: python package confusion Lipska the Kat <lipska@lipskathekat.com> - 2012-07-23 12:02 +0100
      Re: python package confusion David <bouncingcats@gmail.com> - 2012-07-23 21:16 +1000
        Re: python package confusion Lipska the Kat <lipska@lipskathekat.com> - 2012-07-23 12:43 +0100
    Re: python package confusion Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-07-24 05:38 +0000
      Re: python package confusion Devin Jeanpierre <jeanpierreda@gmail.com> - 2012-07-24 03:49 -0400

csiph-web