jonhadfield / python-hosts

a hosts file manager library written in python
MIT License
125 stars 33 forks source link

hosts.py:Hosts.remove_all_matching: fails with TypeError if hosts file contains empty lines #11

Closed stardust85 closed 7 years ago

stardust85 commented 7 years ago
  File "/usr/lib/python2.6/site-packages/python_hosts/hosts.py", line 261, in <lambda>
    func = lambda entry: entry.comment or name not in entry.names
TypeError: argument of type 'NoneType' is not iterable

The code of class HostsEntry looks like it should support blank lines.

Also please add a regression test for that.

stardust85 commented 7 years ago

Please see and merge PR #12, which fixes this issue