[Python-Dev] Re: [Python-checkins] python/dist/src/Lib nntplib.py,1.30,1.31
Just van Rossum
just@letterror.com
Sun, 17 Nov 2002 18:33:29 +0100
Just van Rossum wrote:
> esr@users.sourceforge.net wrote:
>
> > + # If no login/password was specified, try to get them from
~/.netrc
> > + # 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[0]
> > + password = auth[2]
> > + # 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'
>>>
Just