file() doesn't exist in python3 anymore, use open() instead
Signed-off-by: John Kacur <jkacur(a)redhat.com>
---
tuna/oscilloscope.py | 4 ++--
tuna/tuna.py | 8 ++++----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/tuna/oscilloscope.py b/tuna/oscilloscope.py
index ab3d8af77d05..34f51aade8bd 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 367f3f7b8eb6..0ef0bf9c5796 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:
--
2.14.3