summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Kacur <jkacur@redhat.com>2018-05-09 09:49:58 +0100
committerJohn Kacur <jkacur@redhat.com>2018-05-09 09:57:40 +0100
commit93704b06840bf334306dce102dabc996b7ea77f4 (patch)
tree4063441ef676b755b9fd24579d9467e630a1a1e7
parent72c16426a55d5980db02aacf9ea887bf6dfadcd7 (diff)
downloadtuna-93704b06840bf334306dce102dabc996b7ea77f4.tar.gz
tuna: Use open instead of file for python3
file() doesn't exist in python3 anymore, use open() instead Signed-off-by: John Kacur <jkacur@redhat.com>
-rwxr-xr-xtuna/oscilloscope.py4
-rwxr-xr-xtuna/tuna.py8
2 files changed, 6 insertions, 6 deletions
diff --git a/tuna/oscilloscope.py b/tuna/oscilloscope.py
index ab3d8af..34f51aa 100755
--- a/tuna/oscilloscope.py
+++ b/tuna/oscilloscope.py
@@ -433,10 +433,10 @@ class cyclictestoscope(oscilloscope):
if sample > self.avg:
print(sample)
try:
- f = file("/sys/kernel/debug/tracing/trace")
+ f = open("/sys/kernel/debug/tracing/trace")
trace = f.readlines()
f.close()
- f = file("/sys/kernel/debug/tracing/tracing_max_latency", "w")
+ f = open("/sys/kernel/debug/tracing/tracing_max_latency", "w")
f.write("0\n")
f.close()
except:
diff --git a/tuna/tuna.py b/tuna/tuna.py
index 367f3f7..0ef0bf9 100755
--- a/tuna/tuna.py
+++ b/tuna/tuna.py
@@ -55,7 +55,7 @@ def iskthread(pid):
# in this function, so that they know that the thread vanished and
# can act accordingly, removing entries from tree views, etc
try:
- f = file("/proc/%d/smaps" % pid)
+ f = open("/proc/%d/smaps" % pid)
except IOError:
# Thread has vanished
return True
@@ -96,7 +96,7 @@ def has_threaded_irqs(ps):
def set_irq_affinity_filename(filename, bitmasklist):
pathname="/proc/irq/%s" % filename
- f = file(pathname, "w")
+ f = open(pathname, "w")
text = ",".join(["%x" % a for a in bitmasklist])
f.write("%s\n" % text)
try:
@@ -337,7 +337,7 @@ def affinity_remove_cpus(affinity, cpus, nr_cpus):
# Shound be moved to python_linux_procfs.interrupts, shared with interrupts.parse_affinity, etc.
def parse_irq_affinity_filename(filename, nr_cpus):
- f = file("/proc/irq/%s" % filename)
+ f = open("/proc/irq/%s" % filename)
line = f.readline()
f.close()
return utilist.bitmasklist(line, nr_cpus)
@@ -650,7 +650,7 @@ def run_command(cmd, policy, rtprio, cpu_list):
os.waitpid(newpid, 0);
def generate_rtgroups(filename, kthreads, nr_cpus):
- f = file(filename, "w")
+ f = open(filename, "w")
f.write('''# Generated by tuna
#
# Use it with rtctl: