aboutsummaryrefslogtreecommitdiffstats
path: root/run/proc_entry.py
blob: 4ac2c512eda5cf242d9b6f1e539d6bf1f8d21ba0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import os

class ProcEntry(object):
    def __init__(self, proc, data):
        self.proc = proc
        self.data = data

    def write_proc(self):
        if not os.path.exists(self.proc):
            raise Exception("Invalid proc entry %s" % self.proc)
        try:
            with open(self.proc, 'w') as entry:
                entry.write(self.data)
        except:
            print("Failed to write into %s value:\n%s" % (self.proc, self.data))