![]() |
Un-write
Intro:
I am a procrastinator. I start to do work and end up on facebook or otherwise. There exists an app for OS X, Self-Control. It uses the hosts file to redirect requests to localhost. However, such an app is not near the surface of google (and if it is, don't tell me. I'm nearly done writing it) for windows. Meat of the Post: I have a File IO class that writes and "unwrites" to the host file: Code:
un_write(ip_string, hosts). It doesn't un-write. (note, the print statements are only for debugging purposes). It writes it back exactly how it was.What am I doing wrong here? |
why would you write classes for that stuff?
check 'grep', 'sed' and 'echo' utilities. that's all you need. you have sources for those. just recompile (i'm sure you'll finde ports) for your system and use them |
Quote:
I come from Java where the two are virtually synonymous, and the convention is one public class per file. Also, I am aware of ports for shell commands, if that is what you are referring to, but I am not concerned about those. I am learning Python, which needn't be recompiled, and this is a simple project to help me learn as well as solve a practical problem. No offense intended, but I would like an answer to the question asked, not a correction. |
| All times are GMT +1. The time now is 08:27 PM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.