|| at Feb 8, 2011 at 2:54 pm
On 2011-02-08, Chris Rebert wrote:
On Tue, Feb 8, 2011 at 5:26 AM, gracemia gracemia wrote:
??File "prueba.py", line 4, in <module>
?? ??sock = socket(AF_UNIX, SOCK_STREAM)
NameError: name 'AF_UNIX' is not defined
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.