51
52 if "IPKernelApp" not in get_ipython().config: # pragma: no cover
53 in_notebook = False
54 except Exception:55 in_notebook = False
56 _flags["in_notebook"] = in_notebook
57 return in_notebook
25 try:
26 audio = MP3(track_path)
27 length = audio.info.length
28 except Exception:29 # Default fallback
30 length = 3
31 return length
45 def wrapped_function(*args):
46 try:
47 original_func(*args)
48 except Exception as e:49 track_path = _get_track_path(self.track)
50 if self.ascii_err:
51 from pyfiglet import figlet_format
If the except block catches a very general exception, it is likely to catch any unrelated errors too. Try to be more explicit about which exception(s) you're trying to catch.
If you need to catch every other exception, then mark it as intentional by
adding a # skipcq
comment.
try:
x = a / b
except Exception:
x = a / (b + 1)
try:
line = input('Enter numbers:')
numbers = [int(i) for i in line.split()]
except BaseException:
print('Only use numbers for the input')
try:
x = a / b
except ZeroDivisionError:
x = a / (b + 1)
try:
event_loop.run()
except Exception as exc: # skipcq: PYL-W0703 - Loop can sometimes crash.
sentry.report(exc)
try:
line = input('Enter numbers:')
numbers = [int(i) for i in line.split()]
except ValueError:
print('Only use numbers for the input')