Pythn 2.7+: open arg defaults to r

This commit is contained in:
Paul J. Dorn 2023-12-09 04:06:40 +01:00
parent 78ef73b63e
commit ec85b32d3b

View File

@ -51,7 +51,7 @@ class Pidfile:
def unlink(self): def unlink(self):
""" delete pidfile""" """ delete pidfile"""
try: try:
with open(self.fname, "r") as f: with open(self.fname) as f:
pid1 = int(f.read() or 0) pid1 = int(f.read() or 0)
if pid1 == self.pid: if pid1 == self.pid:
@ -64,7 +64,7 @@ class Pidfile:
if not self.fname: if not self.fname:
return return
try: try:
with open(self.fname, "r") as f: with open(self.fname) as f:
try: try:
wpid = int(f.read()) wpid = int(f.read())
except ValueError: except ValueError: