This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rmstoi
Recipients rmstoi
Date 2011-05-05.13:25:47
SpamBayes Score 4.708e-06
Marked as misclassified No
Message-id <1304601950.35.0.920336944366.issue12009@psf.upfronthosting.co.za>
In-reply-to
Content
It seems recent patch from Issue 10464 has introduced problems into
one line comment handling of netrc module.


Problem 1:

If there is a line starting with a comment sign the
following traceback is shown:

Traceback (most recent call last):
  File "/usr/lib/python2.7/netrc.py", line 32, in __init__
    self._parse(file, fp)
  File "/usr/lib/python2.7/netrc.py", line 90, in _parse
    file, lexer.lineno)
netrc.NetrcParseError: bad follower token '#' (./.netrc, line 3)


This can be fixed by modifying netrc.py like this:
71c71
<                 if (tt=='' or tt == 'machine' or
---
>                 if (tt=='' or tt == 'machine' or tt[0] == "#" or

Problem 2:

Now with the patch above it seems to work as long as there are
no comment lines like these:

a) with only pound sign:
#

b) with a pound sign followed by text without any space in between
#comment

If comment line like that is followed by netrc token that token
is consumed by fp.readline(). For example, if netrc file has
these contents:

<<<

machine host.domain.com login username password something

# comment1
machine host2.domain.com login username2 password something2

#comment2
machine host3.domain.com login username3 password something3

#
machine host4.domain.com login username4 password something4
>>>

netrc object will have entries only for host3 and host4.
History
Date User Action Args
2011-05-05 13:25:50rmstoisetrecipients: + rmstoi
2011-05-05 13:25:50rmstoisetmessageid: <1304601950.35.0.920336944366.issue12009@psf.upfronthosting.co.za>
2011-05-05 13:25:47rmstoilinkissue12009 messages
2011-05-05 13:25:47rmstoicreate