Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #56051
| From | Grant Edwards <invalid@invalid.invalid> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: Where and when does Python say this to you? |
| Date | 2011-02-08 14:54 +0000 |
| Organization | PANIX Public Access Internet and UNIX, NYC |
| 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> |
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 | Next — Previous in thread | Next in thread | Find similar | Unroll 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