mirror of
https://github.com/StevenBlack/hosts.git
synced 2026-11-21 17:46:31 +00:00
Making it work in Python3.
This commit is contained in:
1 parent
1dd1d41f5e
commit
c565266416
1 file changed
+5
-2
+5
-2
@@ -292,9 +292,12 @@ def removeDupsAndExcl(mergeFile):
|
||||
os.makedirs(outputPath)
|
||||
|
||||
# Another mode is required to read and write the file in Python 3
|
||||
finalFile = open(os.path.join(outputPath, 'hosts'), 'r+')
|
||||
mergeFile.seek(0) # reset file pointer
|
||||
if Python3:
|
||||
finalFile = open(os.path.join(outputPath, 'hosts'), 'w+b')
|
||||
else:
|
||||
finalFile = open(os.path.join(outputPath, 'hosts'), 'w+')
|
||||
|
||||
mergeFile.seek(0) # reset file pointer
|
||||
hostnames = set()
|
||||
hostnames.add("localhost")
|
||||
hostnames.add("localhost.localdomain")
|
||||
|
||||
Reference in new issue
Block a user