mirror of
https://github.com/dustinkirkland/byobu
synced 2025-08-14 10:46:58 -07:00
fix pep8 E722 failures (no bare except)
* usr/lib/byobu/include/config.py.in: replace all 'except:' instances by 'except Exception:'. LP: #1711026. * usr/lib/byobu/include/config.py.in: same.
This commit is contained in:
parent
5933fd21f3
commit
2b6e2e18e7
2 changed files with 14 additions and 14 deletions
|
@ -42,7 +42,7 @@ def error(msg):
|
|||
try:
|
||||
import snack
|
||||
from snack import *
|
||||
except:
|
||||
except Exception:
|
||||
error("Could not import the python snack module")
|
||||
|
||||
|
||||
|
@ -81,7 +81,7 @@ def ioctl_GWINSZ(fd):
|
|||
import struct
|
||||
import os
|
||||
cr = struct.unpack('hh', fcntl.ioctl(fd, termios.TIOCGWINSZ, '1234'))
|
||||
except:
|
||||
except Exception:
|
||||
return None
|
||||
return cr
|
||||
|
||||
|
@ -96,7 +96,7 @@ def reload_required():
|
|||
f.close()
|
||||
if BYOBU_BACKEND == "screen":
|
||||
subprocess.call([BYOBU_BACKEND, "-X", "at", "0", "source", "%s/profile" % BYOBU_CONFIG_DIR])
|
||||
except:
|
||||
except Exception:
|
||||
True
|
||||
|
||||
|
||||
|
@ -110,13 +110,13 @@ def terminal_size():
|
|||
fd = os.open(os.ctermid(), os.O_RDONLY)
|
||||
cr = ioctl_GWINSZ(fd)
|
||||
os.close(fd)
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
if not cr:
|
||||
# env vars or finally defaults
|
||||
try:
|
||||
cr = (env['LINES'], env['COLUMNS'])
|
||||
except:
|
||||
except Exception:
|
||||
cr = (25, 80)
|
||||
# reverse rows, cols
|
||||
return int(cr[1] - 5), int(cr[0] - 5)
|
||||
|
@ -173,7 +173,7 @@ def readstatus():
|
|||
if os.path.exists(f):
|
||||
try:
|
||||
exec(open(f).read(), glo, loc)
|
||||
except:
|
||||
except Exception:
|
||||
error("Invalid configuration [%s]" % f)
|
||||
if BYOBU_BACKEND == "tmux":
|
||||
items = "%s %s" % (loc["tmux_left"], loc["tmux_right"])
|
||||
|
@ -217,13 +217,13 @@ def writestatus(items):
|
|||
if key.startswith(BYOBU_BACKEND):
|
||||
try:
|
||||
f = open(path, "r")
|
||||
except:
|
||||
except Exception:
|
||||
f = open(SHARE + '/status/status', "r")
|
||||
lines = f.readlines()
|
||||
f.close()
|
||||
try:
|
||||
f = open(path, "w")
|
||||
except:
|
||||
except Exception:
|
||||
f = open(path, "a+")
|
||||
for l in lines:
|
||||
if l.startswith("%s=" % key):
|
||||
|
@ -341,7 +341,7 @@ def chgesc(snackScreen, size):
|
|||
try:
|
||||
dummy = int(esc.value())
|
||||
esc.set(DEF_ESC)
|
||||
except:
|
||||
except Exception:
|
||||
# do nothing
|
||||
dummy = "foo"
|
||||
else:
|
||||
|
@ -363,7 +363,7 @@ def autolaunch():
|
|||
for line in open("%s/.profile" % HOME):
|
||||
if "byobu-launch" in line:
|
||||
return 1
|
||||
except:
|
||||
except Exception:
|
||||
return 0
|
||||
if os.path.exists("/etc/profile.d/Z97-%s.sh" % PKG):
|
||||
return 1
|
||||
|
|
|
@ -27,7 +27,7 @@ import subprocess
|
|||
try:
|
||||
# For Python3, try and import input from builtins
|
||||
from builtins import input
|
||||
except:
|
||||
except Exception:
|
||||
# But fall back to using the default input
|
||||
True
|
||||
|
||||
|
@ -156,14 +156,14 @@ if len(sessions) > 1:
|
|||
try:
|
||||
try:
|
||||
user_input = input("\nChoose 1-%d [1]: " % (i - 1))
|
||||
except:
|
||||
except Exception:
|
||||
user_input = ""
|
||||
if not user_input or user_input == "":
|
||||
choice = 1
|
||||
break
|
||||
try:
|
||||
choice = int(user_input)
|
||||
except:
|
||||
except Exception:
|
||||
choice = int(eval(user_input))
|
||||
if choice >= 1 and choice < i:
|
||||
break
|
||||
|
@ -174,7 +174,7 @@ if len(sessions) > 1:
|
|||
except KeyboardInterrupt:
|
||||
sys.stdout.write("\n")
|
||||
sys.exit(0)
|
||||
except:
|
||||
except Exception:
|
||||
if choice == "" or choice == -1:
|
||||
choice = 1
|
||||
break
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue