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


Groups > comp.lang.python > #56051

Re: Where and when does Python say this to you?

Path csiph.com!eeepc.pasdenom.info!news.pasdenom.info!news.dougwise.org!aioe.org!feeder.news-service.com!feeder3.cambriumusenet.nl!feed.tweaknews.nl!209.197.12.246.MISMATCH!nx02.iad01.newshosting.com!newshosting.com!198.186.194.249.MISMATCH!transit3.readnews.com!news-out.readnews.com!transit4.readnews.com!panix!not-for-mail
From Grant Edwards <invalid@invalid.invalid>
Newsgroups comp.lang.python
Subject Re: Where and when does Python say this to you?
Date Tue, 8 Feb 2011 14:54:20 +0000 (UTC)
Organization PANIX Public Access Internet and UNIX, NYC
Lines 30
Message-ID <iirles$p1j$1@reader1.panix.com> (permalink)
References <b2134cf5-d4d0-4538-a240-0e3d0b7aacfb@w19g2000yqa.googlegroups.com> <20112882627usenet@eggheadcafe.com> <mailman.5.1297172432.1633.python-list@python.org>
NNTP-Posting-Host dsl.comtrol.com
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Transfer-Encoding 7bit
X-Trace reader1.panix.com 1297176860 25651 64.122.56.22 (8 Feb 2011 14:54:20 GMT)
X-Complaints-To abuse@panix.com
NNTP-Posting-Date Tue, 8 Feb 2011 14:54:20 +0000 (UTC)
User-Agent slrn/pre0.9.9-102 (Linux)
Xref csiph.com comp.lang.python:56051

Show key headers only | View raw


On 2011-02-08, Chris Rebert <clp2@rebertia.com> wrote:
> On Tue, Feb 8, 2011 at 5:26 AM, gracemia gracemia <gracemia@gmail.com> wrote:
>> ??File "prueba.py", line 4, in <module>
>> ?? ??sock = socket(AF_UNIX, SOCK_STREAM)
>> NameError: name 'AF_UNIX' is not defined
>>
>> code:
>>
>> import socket
>> sock = socket(AF_UNIX, SOCK_STREAM)
>
> You need to qualify all those names. Normal `import` doesn't dump all
> the importee's names into the importer's namespace;

Unfortunately, it's somewhat common for example code in various places
to show the above usage (where somebody did a "from <whatever> import
*).  IIRC there used to be examples like that even in the official
docs, but I haven't seen any there in a while.

But examples that look like that are still pretty easy to stumble
across using Google.

I'm guessing he copied the code from a "tutorial" example like this:

http://www.evolt.org/node/60276

-- 
Grant Edwards               grant.b.edwards        Yow! hubub, hubub, HUBUB,
                                  at               hubub, hubub, hubub, HUBUB,
                              gmail.com            hubub, hubub, hubub.

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


Thread

Re: AF_UNIX socket not supported Jean-Paul Calderone <calderone.jeanpaul@gmail.com> - 2011-02-08 04:49 -0800
  Re: Where and when does Python say this to you? gracemia gracemia <gracemia@gmail.com> - 2011-02-08 13:27 +0000
  Re: Where and when does Python say this to you? gracemia gracemia <gracemia@gmail.com> - 2011-02-08 13:26 +0000
    Re: Where and when does Python say this to you? Grant Edwards <invalid@invalid.invalid> - 2011-02-08 14:54 +0000
  Re: Where and when does Python say this to you? gracemia gracemia <gracemia@gmail.com> - 2011-02-08 13:28 +0000

csiph-web