388 if mtime <= rtime:
389 self.respond('304 Not Modified')
390 return
391 except Exception as e:392 pass
393
394 http_range = self.env.get('HTTP_RANGE', None)
66 try:
67 shell = subprocess.check_output(['which', sh])
68 break
69 except Exception as e: 70 pass
71 self.command = shell
72
67 try:
68 svc.running = self._run_action(_id, 'status')
69 svc.state = 'running' if svc.running else 'stopped'
70 except Exception as e: 71 svc.running = False
72 return svc
73
18 try:
19 yum.YumBase().doGenericSetup(cache=1)
20 return True
21 except Exception as e: 22 return False
23
24 def __init__(self, context):
157 chunk_dir = f'/tmp/upload-{id}'
158 try:
159 os.makedirs(chunk_dir)
160 except Exception as e:161 pass
162 chunk_path = os.path.join(chunk_dir, chunk_index)
163
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')