jonhadfield / python-hosts

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

Cannot Remove/Override the existing host records #9

Closed cfatduck closed 7 years ago

cfatduck commented 7 years ago

I've got below error when i was trying to remove_all_matching by using name or set the force=True in adding a host record.

Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/python_hosts/hosts.py", line 371, in add self.remove_all_matching(name=entry.names) File "/usr/local/lib/python2.7/dist-packages/python_hosts/hosts.py", line 264, in remove_all_matching self.entries = list(filter(func, self.entries)) File "/usr/local/lib/python2.7/dist-packages/python_hosts/hosts.py", line 261, in func = lambda entry: entry.comment or name not in entry.names TypeError: argument of type 'NoneType' is not iterable

123BLiN commented 7 years ago

Not sure, but possibly could be fixed in https://github.com/jonhadfield/python-hosts/pull/10

jonhadfield commented 7 years ago

Yes, that should be fixed now, but please let me know if you still get the same issue.