Question: I have the following:

```
import netrc

machine = 'ftp.example.com'
auth = netrc.netrc().authenticators(machine)

```

I have the following line in my `.netrc` file:

```
machine "### comment"

```

I get the following error:

> 
> netrc.NetrcParseError: bad follower token 'comment"'
> 
> 
> 

I can remove the comment, but I need to use this on other accounts where I can not edit the `.netrc` file, so what to do here?

Answer: 
Doesn't your line need to be

```
machine ftp.example.com login user password pw

```

If you start the line with 'machine' you at least need a machine name, before you comment out the rest of the line, otherwise netrc can't parse the line.
I believe it's parsing the line without treating the quotation marks any differently from other non-whitespace characters. So this:

```
machine "### comment"

```

gets turned into the tokens `machine`, `"###`, and `comment"`. After that, it can't find any more tokens, and it barfs.

Unfortunately, since there are lots of netrc parsers out there and they might all have different handling of edge cases, you can't really even solve this by writing your own parser unless you can get that parser used by your favorite tools (curl, pip, etc.).

As a further aside on comments, apparently the Python `netrc` module will recognize `# machine ...` (with a space) but not `#machine ...` (without a space) as a comment line. The latter results in various errors like `netrc.NetrcParseError: bad toplevel token '...'`, which tools like `pip` seem to hide from you, pretending there are no entries in the file.