Merge ~twom/launchpad:lint-e722 into launchpad:master

Proposed by Tom Wardill
Status: Merged
Approved by: Tom Wardill
Approved revision: 06424d4dd42eb1c02a7a6f3a2d136290d608f730
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~twom/launchpad:lint-e722
Merge into: launchpad:master
Diff against target: 521 lines (+46/-46)
32 files modified
lib/lp/archivepublisher/scripts/publish_ftpmaster.py (+1/-1)
lib/lp/archivepublisher/tests/test_publish_ftpmaster.py (+1/-1)
lib/lp/archiveuploader/dscfile.py (+1/-1)
lib/lp/archiveuploader/uploadprocessor.py (+4/-4)
lib/lp/bugs/externalbugtracker/bugzilla.py (+1/-1)
lib/lp/bugs/scripts/checkwatches/base.py (+1/-1)
lib/lp/bugs/vocabularies.py (+1/-1)
lib/lp/code/model/directbranchcommit.py (+1/-1)
lib/lp/code/model/sourcepackagerecipebuild.py (+1/-1)
lib/lp/codehosting/puller/scheduler.py (+1/-1)
lib/lp/codehosting/puller/tests/__init__.py (+1/-1)
lib/lp/codehosting/upgrade.py (+1/-1)
lib/lp/services/database/__init__.py (+1/-1)
lib/lp/services/database/sqlbase.py (+1/-1)
lib/lp/services/job/runner.py (+2/-2)
lib/lp/services/job/tests/test_celeryjob.py (+1/-1)
lib/lp/services/librarianserver/libraryprotocol.py (+1/-1)
lib/lp/services/librarianserver/storage.py (+2/-2)
lib/lp/services/librarianserver/testing/tests/test_server_fixture.py (+1/-1)
lib/lp/services/profile/profile.py (+1/-1)
lib/lp/services/spriteutils.py (+1/-1)
lib/lp/services/stacktrace.py (+3/-3)
lib/lp/services/twistedsupport/tests/test_processmonitor.py (+1/-1)
lib/lp/services/twistedsupport/tests/test_xmlrpc.py (+1/-1)
lib/lp/services/webapp/publication.py (+1/-1)
lib/lp/soyuz/model/packagecopyjob.py (+1/-1)
lib/lp/soyuz/scripts/gina/changelog.py (+1/-1)
lib/lp/testing/yuixhr.py (+3/-3)
lib/lp/translations/scripts/copy_distroseries_translations.py (+2/-2)
lib/lp/translations/scripts/language_pack.py (+5/-5)
scripts/script-monitor.py (+1/-1)
utilities/community-contributions.py (+1/-1)
Reviewer Review Type Date Requested Status
Colin Watson Approve
Review via email: mp+406640@code.launchpad.net

Commit message

Fix E722 violations

Description of the change

Swap bare except for `except Exception`

To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) wrote :

A number of these are last-ditch cleanup measures, so `except BaseException:` would be appropriate rather than `except Exception:`. (This should normally be used with care because it catches even `SystemExit`, `KeyboardInterrupt`, and `GeneratorExit`, but in most of the cases where we were previously using bare `except`, that's the desired behaviour.) I've noted the cases where I think this should be changed.

review: Approve
Revision history for this message
Colin Watson (cjwatson) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/lib/lp/archivepublisher/scripts/publish_ftpmaster.py b/lib/lp/archivepublisher/scripts/publish_ftpmaster.py
2index e2d22a6..5326141 100644
3--- a/lib/lp/archivepublisher/scripts/publish_ftpmaster.py
4+++ b/lib/lp/archivepublisher/scripts/publish_ftpmaster.py
5@@ -543,7 +543,7 @@ class PublishFTPMaster(LaunchpadCronScript):
6 # Swizzle the now-updated backup dists and the current dists
7 # around.
8 self.installDists(distribution)
9- except:
10+ except BaseException:
11 # If we failed here, there's a chance that we left a
12 # working dists directory in its temporary location. If so,
13 # recover it. The next script run would do that anyway, but
14diff --git a/lib/lp/archivepublisher/tests/test_publish_ftpmaster.py b/lib/lp/archivepublisher/tests/test_publish_ftpmaster.py
15index 2039856..3861a50 100644
16--- a/lib/lp/archivepublisher/tests/test_publish_ftpmaster.py
17+++ b/lib/lp/archivepublisher/tests/test_publish_ftpmaster.py
18@@ -1100,7 +1100,7 @@ class TestCreateDistroSeriesIndexes(TestCaseWithFactory, HelpersMixin):
19 script.runPublishDistro = FakeMethod(failure=Boom("Sorry!"))
20 try:
21 script.createIndexes(series.distribution, [get_a_suite(series)])
22- except:
23+ except Exception:
24 pass
25 self.assertEqual([], script.markIndexCreationComplete.calls)
26
27diff --git a/lib/lp/archiveuploader/dscfile.py b/lib/lp/archiveuploader/dscfile.py
28index 369f8d9..ba47bd3 100644
29--- a/lib/lp/archiveuploader/dscfile.py
30+++ b/lib/lp/archiveuploader/dscfile.py
31@@ -90,7 +90,7 @@ def unpack_source(dsc_filepath):
32 unpacked_dir = tempfile.mkdtemp()
33 try:
34 extract_dpkg_source(dsc_filepath, unpacked_dir)
35- except:
36+ except Exception:
37 shutil.rmtree(unpacked_dir)
38 raise
39
40diff --git a/lib/lp/archiveuploader/uploadprocessor.py b/lib/lp/archiveuploader/uploadprocessor.py
41index b8d1148..54510c7 100644
42--- a/lib/lp/archiveuploader/uploadprocessor.py
43+++ b/lib/lp/archiveuploader/uploadprocessor.py
44@@ -432,7 +432,7 @@ class UploadHandler:
45 "Committing the transaction and any mails associated "
46 "with this upload.")
47 self.processor.ztm.commit()
48- except:
49+ except BaseException:
50 self.processor.ztm.abort()
51 raise
52
53@@ -605,7 +605,7 @@ class BuildUploadHandler(UploadHandler):
54 "with this upload.")
55 self.processor.ztm.commit()
56 return UploadStatusEnum.ACCEPTED
57- except:
58+ except BaseException:
59 self.processor.ztm.abort()
60 raise
61
62@@ -630,7 +630,7 @@ class BuildUploadHandler(UploadHandler):
63 except UploadError as e:
64 logger.error(str(e))
65 return UploadStatusEnum.REJECTED
66- except:
67+ except BaseException:
68 self.processor.ztm.abort()
69 raise
70
71@@ -681,7 +681,7 @@ class BuildUploadHandler(UploadHandler):
72 except UploadError as e:
73 logger.error(str(e))
74 return UploadStatusEnum.REJECTED
75- except:
76+ except BaseException:
77 self.processor.ztm.abort()
78 raise
79
80diff --git a/lib/lp/bugs/externalbugtracker/bugzilla.py b/lib/lp/bugs/externalbugtracker/bugzilla.py
81index 7ab8ac5..830f680 100644
82--- a/lib/lp/bugs/externalbugtracker/bugzilla.py
83+++ b/lib/lp/bugs/externalbugtracker/bugzilla.py
84@@ -517,7 +517,7 @@ class Bugzilla(ExternalBugTracker):
85 if bug_id not in self.remote_bug_importance:
86 return "Bug %s is not in remote_bug_importance" % bug_id
87 return self.remote_bug_importance[bug_id]
88- except:
89+ except Exception:
90 return UNKNOWN_REMOTE_IMPORTANCE
91
92 def getRemoteStatus(self, bug_id):
93diff --git a/lib/lp/bugs/scripts/checkwatches/base.py b/lib/lp/bugs/scripts/checkwatches/base.py
94index 016ea8e..a778b78 100644
95--- a/lib/lp/bugs/scripts/checkwatches/base.py
96+++ b/lib/lp/bugs/scripts/checkwatches/base.py
97@@ -163,7 +163,7 @@ class WorkingBase:
98 check_no_transaction()
99 try:
100 yield self._transaction_manager
101- except:
102+ except BaseException:
103 self._transaction_manager.abort()
104 # Let the exception propagate.
105 raise
106diff --git a/lib/lp/bugs/vocabularies.py b/lib/lp/bugs/vocabularies.py
107index 7863a3b..5c4c70a 100644
108--- a/lib/lp/bugs/vocabularies.py
109+++ b/lib/lp/bugs/vocabularies.py
110@@ -407,7 +407,7 @@ class BugTaskMilestoneVocabulary:
111 """See `IVocabularyTokenized`."""
112 try:
113 return self.toTerm(self.milestones[str(token)])
114- except:
115+ except Exception:
116 raise LookupError(token)
117
118 def __len__(self):
119diff --git a/lib/lp/code/model/directbranchcommit.py b/lib/lp/code/model/directbranchcommit.py
120index 89586b0..17f0e8d 100644
121--- a/lib/lp/code/model/directbranchcommit.py
122+++ b/lib/lp/code/model/directbranchcommit.py
123@@ -118,7 +118,7 @@ class DirectBranchCommit:
124 db_branch, get_branch_info(self.bzrbranch))
125
126 self.is_open = True
127- except:
128+ except BaseException:
129 self.unlock()
130 raise
131
132diff --git a/lib/lp/code/model/sourcepackagerecipebuild.py b/lib/lp/code/model/sourcepackagerecipebuild.py
133index 0320c77..aac5a0f 100644
134--- a/lib/lp/code/model/sourcepackagerecipebuild.py
135+++ b/lib/lp/code/model/sourcepackagerecipebuild.py
136@@ -257,7 +257,7 @@ class SourcePackageRecipeBuild(SpecificBuildFarmJobSourceMixin,
137 ' - cannot build against %s.' % series_name)
138 except ProgrammingError:
139 raise
140- except:
141+ except Exception:
142 logger.exception(' - problem with %s', series_name)
143 else:
144 logger.debug(' - build requested for %s', series_name)
145diff --git a/lib/lp/codehosting/puller/scheduler.py b/lib/lp/codehosting/puller/scheduler.py
146index e0b8363..90442cb 100644
147--- a/lib/lp/codehosting/puller/scheduler.py
148+++ b/lib/lp/codehosting/puller/scheduler.py
149@@ -151,7 +151,7 @@ class PullerWireProtocol(NetstringReceiver):
150 try:
151 try:
152 method(*self._current_args)
153- except:
154+ except Exception:
155 self.puller_protocol.unexpectedError(failure.Failure())
156 finally:
157 self._resetState()
158diff --git a/lib/lp/codehosting/puller/tests/__init__.py b/lib/lp/codehosting/puller/tests/__init__.py
159index 350eda7..2d5b0ae 100644
160--- a/lib/lp/codehosting/puller/tests/__init__.py
161+++ b/lib/lp/codehosting/puller/tests/__init__.py
162@@ -74,7 +74,7 @@ def fixed_handle_request(self):
163 if self.verify_request(request, client_address):
164 try:
165 self.process_request(request, client_address)
166- except:
167+ except Exception:
168 self.handle_error(request, client_address)
169 self.close_request(request)
170
171diff --git a/lib/lp/codehosting/upgrade.py b/lib/lp/codehosting/upgrade.py
172index 2159871..54112b2 100755
173--- a/lib/lp/codehosting/upgrade.py
174+++ b/lib/lp/codehosting/upgrade.py
175@@ -174,7 +174,7 @@ class Upgrader:
176 bzrdir = BzrDir.create(upgrade_dir, self.get_target_format())
177 repository = bzrdir.create_repository()
178 repository.fetch(self.bzr_branch.repository)
179- except:
180+ except Exception:
181 rmtree(upgrade_dir)
182 raise
183 else:
184diff --git a/lib/lp/services/database/__init__.py b/lib/lp/services/database/__init__.py
185index 5af379f..3bbca06 100644
186--- a/lib/lp/services/database/__init__.py
187+++ b/lib/lp/services/database/__init__.py
188@@ -77,7 +77,7 @@ def write_transaction(func):
189 transaction.begin()
190 try:
191 ret = func(*args, **kwargs)
192- except:
193+ except BaseException:
194 transaction.abort()
195 raise
196 transaction.commit()
197diff --git a/lib/lp/services/database/sqlbase.py b/lib/lp/services/database/sqlbase.py
198index cf7d5d5..96a5c62 100644
199--- a/lib/lp/services/database/sqlbase.py
200+++ b/lib/lp/services/database/sqlbase.py
201@@ -205,7 +205,7 @@ class SQLBase(storm.sqlobject.SQLObjectBase):
202 store.add(self)
203 try:
204 self._create(None, **kwargs)
205- except:
206+ except Exception:
207 store.remove(self)
208 raise
209
210diff --git a/lib/lp/services/job/runner.py b/lib/lp/services/job/runner.py
211index 2ec4506..e37b54e 100644
212--- a/lib/lp/services/job/runner.py
213+++ b/lib/lp/services/job/runner.py
214@@ -677,9 +677,9 @@ class TwistedJobRunner(BaseJobRunner):
215 if job is None:
216 self.logger.info('No jobs to run.')
217 self.terminated()
218- except:
219+ except BaseException:
220 self.failed(failure.Failure())
221- except:
222+ except BaseException:
223 self.terminated()
224 raise
225
226diff --git a/lib/lp/services/job/tests/test_celeryjob.py b/lib/lp/services/job/tests/test_celeryjob.py
227index 22ec50e..9757d36 100644
228--- a/lib/lp/services/job/tests/test_celeryjob.py
229+++ b/lib/lp/services/job/tests/test_celeryjob.py
230@@ -86,7 +86,7 @@ class TestRunMissingJobs(TestCaseWithFactory):
231 missing_ready = find_missing_ready_obj.find_missing_ready()
232 try:
233 self.assertEqual([], missing_ready)
234- except:
235+ except Exception:
236 # XXX AaronBentley: 2012-08-01 bug=1031018: Extra diagnostic info
237 # to help diagnose this hard-to-reproduce failure.
238 self.addTextDetail('queued_job_ids',
239diff --git a/lib/lp/services/librarianserver/libraryprotocol.py b/lib/lp/services/librarianserver/libraryprotocol.py
240index c59ca28..bd11e39 100644
241--- a/lib/lp/services/librarianserver/libraryprotocol.py
242+++ b/lib/lp/services/librarianserver/libraryprotocol.py
243@@ -74,7 +74,7 @@ class FileUploadProtocol(basic.LineReceiver):
244 getattr(self, 'line_' + self.state, self.badLine)(line)
245 except ProtocolViolation as e:
246 self.sendError(e.msg)
247- except:
248+ except Exception:
249 self.unknownError()
250
251 def sendError(self, msg, code='400'):
252diff --git a/lib/lp/services/librarianserver/storage.py b/lib/lp/services/librarianserver/storage.py
253index 053f37d..cebcd59 100644
254--- a/lib/lp/services/librarianserver/storage.py
255+++ b/lib/lp/services/librarianserver/storage.py
256@@ -271,7 +271,7 @@ class LibraryFileUpload(object):
257 aliasID = None
258 self.debugLog.append('received contentID: %r' % (contentID, ))
259
260- except:
261+ except Exception:
262 # Abort transaction and re-raise
263 self.debugLog.append('failed to get contentID/aliasID, aborting')
264 raise
265@@ -279,7 +279,7 @@ class LibraryFileUpload(object):
266 # Move file to final location
267 try:
268 self._move(contentID)
269- except:
270+ except Exception:
271 # Abort DB transaction
272 self.debugLog.append('failed to move file, aborting')
273
274diff --git a/lib/lp/services/librarianserver/testing/tests/test_server_fixture.py b/lib/lp/services/librarianserver/testing/tests/test_server_fixture.py
275index c315ca4..c960098 100644
276--- a/lib/lp/services/librarianserver/testing/tests/test_server_fixture.py
277+++ b/lib/lp/services/librarianserver/testing/tests/test_server_fixture.py
278@@ -83,7 +83,7 @@ class TestLibrarianServerFixture(TestCase):
279 fixture.restricted_download_port,
280 )
281 self.assertEqual(expected_config, fixture.service_config)
282- except:
283+ except Exception:
284 self.attachLibrarianLog(fixture)
285 raise
286
287diff --git a/lib/lp/services/profile/profile.py b/lib/lp/services/profile/profile.py
288index 85e98f1..e98f17f 100644
289--- a/lib/lp/services/profile/profile.py
290+++ b/lib/lp/services/profile/profile.py
291@@ -89,7 +89,7 @@ class Profiler:
292 self.profiler_lock.acquire(True) # Blocks.
293 try:
294 self.enable()
295- except:
296+ except Exception:
297 self.profiler_lock.release()
298 self.started = False
299 raise
300diff --git a/lib/lp/services/spriteutils.py b/lib/lp/services/spriteutils.py
301index 2ecd703..735f706 100644
302--- a/lib/lp/services/spriteutils.py
303+++ b/lib/lp/services/spriteutils.py
304@@ -195,7 +195,7 @@ class SpriteUtil:
305 for x_position in range(width, max_sprite_width, width):
306 position[0] = x_position
307 combined_image.paste(sprite_image, tuple(position))
308- except:
309+ except Exception:
310 print(
311 "Error with image file %s" % sprite['filename'],
312 file=sys.stderr)
313diff --git a/lib/lp/services/stacktrace.py b/lib/lp/services/stacktrace.py
314index 6b3cacb..10b6764 100644
315--- a/lib/lp/services/stacktrace.py
316+++ b/lib/lp/services/stacktrace.py
317@@ -29,7 +29,7 @@ def _try_except(callable, *args, **kwargs):
318 return callable(*args, **kwargs)
319 except EXPLOSIVE_ERRORS:
320 raise
321- except:
322+ except Exception:
323 if DEBUG_EXCEPTION_FORMATTER:
324 traceback.print_exc(file=sys.stderr)
325 # return None
326@@ -100,7 +100,7 @@ def format_list(extracted_list):
327 item.append(_fmt(info))
328 except EXPLOSIVE_ERRORS:
329 raise
330- except:
331+ except Exception:
332 # The values above may not stringify properly, or who knows what
333 # else. Be defensive.
334 if DEBUG_EXCEPTION_FORMATTER:
335@@ -170,7 +170,7 @@ def _get_frame_data(f, lineno):
336 warnings.append(warning)
337 except EXPLOSIVE_ERRORS:
338 raise
339- except:
340+ except Exception:
341 if DEBUG_EXCEPTION_FORMATTER:
342 traceback.print_exc(file=sys.stderr)
343 supplement_dict = dict(warnings=warnings, extra=extra)
344diff --git a/lib/lp/services/twistedsupport/tests/test_processmonitor.py b/lib/lp/services/twistedsupport/tests/test_processmonitor.py
345index 3ea4fd7..9ff30f6 100644
346--- a/lib/lp/services/twistedsupport/tests/test_processmonitor.py
347+++ b/lib/lp/services/twistedsupport/tests/test_processmonitor.py
348@@ -35,7 +35,7 @@ def makeFailure(exception_factory, *args, **kwargs):
349 """
350 try:
351 raise exception_factory(*args, **kwargs)
352- except:
353+ except Exception:
354 return failure.Failure()
355
356
357diff --git a/lib/lp/services/twistedsupport/tests/test_xmlrpc.py b/lib/lp/services/twistedsupport/tests/test_xmlrpc.py
358index ebe72e9..126d275 100644
359--- a/lib/lp/services/twistedsupport/tests/test_xmlrpc.py
360+++ b/lib/lp/services/twistedsupport/tests/test_xmlrpc.py
361@@ -52,7 +52,7 @@ class TestTrapFault(TestCase):
362 """Make a `Failure` from the given exception factory."""
363 try:
364 raise exception_factory(*args, **kwargs)
365- except:
366+ except Exception:
367 return Failure()
368
369 def assertRaisesFailure(self, failure, function, *args, **kwargs):
370diff --git a/lib/lp/services/webapp/publication.py b/lib/lp/services/webapp/publication.py
371index 955685a..6aadefe 100644
372--- a/lib/lp/services/webapp/publication.py
373+++ b/lib/lp/services/webapp/publication.py
374@@ -268,7 +268,7 @@ class LaunchpadBrowserPublication(
375 request_txt = 'Exception converting request to string\n\n'
376 try:
377 request_txt += traceback.format_exc()
378- except:
379+ except Exception:
380 request_txt += 'Unable to render traceback!'
381 threadrequestfile.write(request_txt.encode('UTF-8'))
382 threadrequestfile.close()
383diff --git a/lib/lp/soyuz/model/packagecopyjob.py b/lib/lp/soyuz/model/packagecopyjob.py
384index 83c8b1f..4d8871c 100644
385--- a/lib/lp/soyuz/model/packagecopyjob.py
386+++ b/lib/lp/soyuz/model/packagecopyjob.py
387@@ -647,7 +647,7 @@ class PlainPackageCopyJob(PackageCopyJobDerived):
388 pass
389 except (SuspendJobException, AdvisoryLockHeld):
390 raise
391- except:
392+ except Exception:
393 # Abort work done so far, but make sure that we commit the
394 # rejection to the PackageUpload.
395 transaction.abort()
396diff --git a/lib/lp/soyuz/scripts/gina/changelog.py b/lib/lp/soyuz/scripts/gina/changelog.py
397index ec20556..cc31594 100644
398--- a/lib/lp/soyuz/scripts/gina/changelog.py
399+++ b/lib/lp/soyuz/scripts/gina/changelog.py
400@@ -70,7 +70,7 @@ def parse_changelog(changelines):
401 try:
402 (source, version, urgency) = parse_first_line(line.strip())
403 Version(six.ensure_text(version))
404- except:
405+ except Exception:
406 stanza.append(line)
407 #print "state0 Exception skip"
408 continue
409diff --git a/lib/lp/testing/yuixhr.py b/lib/lp/testing/yuixhr.py
410index c21831b..f66295b 100644
411--- a/lib/lp/testing/yuixhr.py
412+++ b/lib/lp/testing/yuixhr.py
413@@ -335,7 +335,7 @@ class YUITestFixtureControllerView(LaunchpadView):
414 suite = suite_factory()
415 except EXPLOSIVE_ERRORS:
416 raise
417- except:
418+ except Exception:
419 warning = 'test_suite raises errors'
420 else:
421 case = None
422@@ -400,7 +400,7 @@ class YUITestFixtureControllerView(LaunchpadView):
423 fixtures[fixture_name](self.request, data)
424 except EXPLOSIVE_ERRORS:
425 raise
426- except:
427+ except Exception:
428 self.request.response.setStatus(500)
429 result = ''.join(format_exception(*sys.exc_info()))
430 else:
431@@ -421,7 +421,7 @@ class YUITestFixtureControllerView(LaunchpadView):
432 fixtures[fixture_name].teardown(self.request, data)
433 except EXPLOSIVE_ERRORS:
434 raise
435- except:
436+ except Exception:
437 self.request.response.setStatus(500)
438 result = ''.join(format_exception(*sys.exc_info()))
439 else:
440diff --git a/lib/lp/translations/scripts/copy_distroseries_translations.py b/lib/lp/translations/scripts/copy_distroseries_translations.py
441index 1196e43..e072246 100644
442--- a/lib/lp/translations/scripts/copy_distroseries_translations.py
443+++ b/lib/lp/translations/scripts/copy_distroseries_translations.py
444@@ -131,7 +131,7 @@ def copy_distroseries_translations(source, target, txn, logger,
445 copy_active_translations(
446 source, target, txn, logger, sourcepackagenames=spns,
447 skip_duplicates=skip_duplicates)
448- except:
449+ except BaseException:
450 copy_failed = True
451 # Give us a fresh transaction for proper cleanup.
452 txn.abort()
453@@ -142,7 +142,7 @@ def copy_distroseries_translations(source, target, txn, logger,
454 statekeeper.restore()
455 except Warning as message:
456 logger.warning(message)
457- except:
458+ except BaseException:
459 logger.warning(
460 "Failed to restore hide_all_translations and "
461 "defer_translation_imports flags on %s after translations "
462diff --git a/lib/lp/translations/scripts/language_pack.py b/lib/lp/translations/scripts/language_pack.py
463index 0ef600f..e70ab7d 100644
464--- a/lib/lp/translations/scripts/language_pack.py
465+++ b/lib/lp/translations/scripts/language_pack.py
466@@ -143,7 +143,7 @@ def export(distroseries, component, update, force_utf8, logger):
467
468 # Store it in the tarball.
469 archive.add_file(path, contents)
470- except:
471+ except Exception:
472 logger.exception(
473 "Uncaught exception while exporting PO file %d" % pofile.id)
474
475@@ -217,8 +217,8 @@ def export_language_pack(distribution_name, series_name, logger,
476 try:
477 filehandle, size = export(
478 distroseries, component, update, force_utf8, logger)
479- except:
480- # Bare except statements are used in order to prevent premature
481+ except Exception:
482+ # Generic exception statements are used in order to prevent premature
483 # termination of the script.
484 logger.exception('Uncaught exception while exporting')
485 return None
486@@ -263,8 +263,8 @@ def export_language_pack(distribution_name, series_name, logger,
487 except UploadFailed as e:
488 logger.error('Uploading to the Librarian failed: %s', e)
489 return None
490- except:
491- # Bare except statements are used in order to prevent premature
492+ except Exception:
493+ # Generic exception statements are used in order to prevent premature
494 # termination of the script.
495 logger.exception(
496 'Uncaught exception while uploading to the Librarian')
497diff --git a/scripts/script-monitor.py b/scripts/script-monitor.py
498index 9671e7e..f859d54 100755
499--- a/scripts/script-monitor.py
500+++ b/scripts/script-monitor.py
501@@ -99,7 +99,7 @@ def main():
502 msg.as_string())
503 smtp.close()
504 return 2
505- except:
506+ except Exception:
507 log.exception("Unhandled exception")
508 return 1
509
510diff --git a/utilities/community-contributions.py b/utilities/community-contributions.py
511index d9c59e2..662d374 100755
512--- a/utilities/community-contributions.py
513+++ b/utilities/community-contributions.py
514@@ -52,7 +52,7 @@ from bzrlib.osutils import format_date
515
516 try:
517 from editmoin import editshortcut
518-except:
519+except ImportError:
520 sys.stderr.write("""ERROR: Unable to import from 'editmoin'. How to solve:
521 Get editmoin.py from launchpadlib's "contrib/" directory:
522

Subscribers

People subscribed via source and target branches

to status/vote changes: