Problem running NNTP example from docs.

David Fisher python at rose164.wuh.wustl.edu
Sat Apr 29 16:52:38 EDT 2000


----- Original Message -----
From: "Arcady Genkin" <a.genkin at utoronto.ca>
Newsgroups: comp.lang.python
To: <python-list at python.org>
Sent: Saturday, April 29, 2000 3:17 PM
Subject: Problem running NNTP example from docs.


> I'm very new to Python, and was trying to run the example from
> documentation to nntplib library. I get an error when I try to
> instantiate NNTP object.
>
> ,----
> | >>> import nntplib
> | >>> s = NNTP('news')

need to be:

s = nntplib.NNTP('news')
      ^^^^^^^

You get a name error because there is no name 'NNTP', but there is a name
'nntplib' with attribute (well, method I guess) 'NNTP'.

dir() will get you a list of names in the global name dictionary.
dir('nntplib') will get you a list of names (attributes) of object
'nntplib'.

dnf


> | Traceback (innermost last):
> |   File "<stdin>", line 1, in ?
> | NameError: NNTP
> `----
>
> Could somebody point out what I am missing?
>
> Thanks!
> --
> Arcady Genkin                                 http://www.thpoon.com
> Nostalgia isn't what it used to be.
> --
> http://www.python.org/mailman/listinfo/python-list





More information about the Python-list mailing list