[Python-Dev] Re: [Python-checkins] python/dist/src/Lib nntplib.py,1.30,1.31
Eric S. Raymond
Sun, 17 Nov 2002 12:36:22 -0500
Just van Rossum <email@example.com>:
> Just van Rossum wrote:
> > firstname.lastname@example.org wrote:
> > > + # If no login/password was specified, try to get them from
> > > + # Presume that if .netc has an entry, NNRP authentication is
> > required.
> > > + if not user:
> > > + import netrc
> > > + credentials = netrc.netrc()
> > > + auth = credentials.authenticators(host)
> > > + if auth:
> > > + user = auth
> > > + password = auth
> > > + # Perform NNRP authentication if needed.
> > Erm, doesn't this make anonymous nntp access fail if there's no $HOME or no
> > ..netrc file in $HOME?
> Ok, since I didn't get a reply (I posted the above to python-checkins), I tried
> it, and yes it does break:
> [python:~] just% python2.3
> Python 2.3a0 (#2, Nov 17 2002, 18:16:38)
> [GCC 3.1 20020420 (prerelease)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> >>> from nntplib import NNTP
> >>> s = NNTP('news')
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> File "/usr/local/lib/python2.3/nntplib.py", line 140, in __init__
> credentials = netrc.netrc()
> File "/usr/local/lib/python2.3/netrc.py", line 29, in __init__
> fp = open(file)
> IOError: [Errno 2] No such file or directory: '/Users/just/.netrc'
Sorry about the lack of reply. I'll put an appropriate guard around the
<a href="http://www.tuxedo.org/~esr/">Eric S. Raymond</a>