Make a "Main" function so that the variables used do not pollute the global namespace.
Showing the changes to tools/perf/scripts/python (1 of 1 file). Show all
Unified · Split
| @@ -284,7 +284,9 @@ class MainWindow(QMainWindow): · 283 unmodified lines | ||
| 284 | 284 | |
| 285 | 285 | self.setCentralWidget(self.view) |
| 286 | 286 | |
| 287 | −if __name__ == '__main__': | |
| 287 | +# Main | |
| 288 | + | |
| 289 | +def Main(): | |
| 288 | 290 | if (len(sys.argv) < 2): |
| 289 | 291 | print >> sys.stderr, "Usage is: call-graph-from-sql.py <database name>" |
| 290 | 292 | raise Exception("Too few arguments") |
| @@ -331,3 +333,6 @@ if __name__ == '__main__': · 40 unmodified lines | ||
| 331 | 333 | err = app.exec_() |
| 332 | 334 | db.close() |
| 333 | 335 | sys.exit(err) |
| 336 | + | |
| 337 | +if __name__ == "__main__": | |
| 338 | + Main() | |