[Pythonmac-SIG] How to set the hosts file using Python

Schollnick, Benjamin Benjamin.Schollnick at usa.xerox.com
Fri Dec 12 08:19:39 EST 2003


Under Mac OS X, the article you have linked does not apply.
 
The hosts file is in /etc/, as a text file named "hosts".
 
Open the file, read the file, parse it to see if your entry is already
included.
 
If not, append the file with the new host entry.
 
If it does exist, assuming the entry is correct, then don't touch the host
file.
If the entry is incorrect, you'll need to write the file with all the old
information, just changing
the single line that is incorrect.
 
        - Benjamin

-----Original Message-----
From: pythonmac-sig-bounces at python.org
[mailto:pythonmac-sig-bounces at python.org]On Behalf Of RANDY BURNS
Sent: Thursday, December 11, 2003 12:50 PM
To: pythonmac-sig at python.org
Subject: [Pythonmac-SIG] How to set the hosts file using Python


I have a small  application that runs on both win32 and MaxOS 10.x that
creates an appropriate 
hosts file on demand(I'm doing this because I need folks to review a web
page on development, test or production servers).
I see how to set the host file manually on the mac. Does anyone have an idea
how this might be done through a python script?
Thanks!
 
http://docs.info.apple.com/article.html?artnum=75085
<http://docs.info.apple.com/article.html?artnum=75085> 


 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/pythonmac-sig/attachments/20031212/9f5dccb8/attachment.html


More information about the Pythonmac-SIG mailing list