Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(255)

Side by Side Diff: tools/dom/scripts/multiemitter.py

Issue 18541003: Catch IOError instead of OSError (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 2 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
3 # for details. All rights reserved. Use of this source code is governed by a 3 # for details. All rights reserved. Use of this source code is governed by a
4 # BSD-style license that can be found in the LICENSE file. 4 # BSD-style license that can be found in the LICENSE file.
5 5
6 """Templating to help generate structured text.""" 6 """Templating to help generate structured text."""
7 7
8 import os 8 import os
9 import re 9 import re
10 import sys 10 import sys
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 if os.path.exists(path): 81 if os.path.exists(path):
82 _logger.info('Removing - %s' % path) 82 _logger.info('Removing - %s' % path)
83 os.remove(path) 83 os.remove(path)
84 84
85 # Write the file. 85 # Write the file.
86 try: 86 try:
87 _logger.info('Writing - %s' % path) 87 _logger.info('Writing - %s' % path)
88 f = open(path, 'w') 88 f = open(path, 'w')
89 f.writelines(lines) 89 f.writelines(lines)
90 f.close() 90 f.close()
91 except OSError as error: 91 except IOError as error:
92 # FIXME(kustermann): Remove this later on. 92 # FIXME(kustermann): Remove this later on.
93 # We try to get more debugging information to figure out why we sometimes 93 # We try to get more debugging information to figure out why we sometimes
94 # get a "Permission denied" error when opening the file for writing. 94 # get a "Permission denied" error when opening the file for writing.
95 # (hypothesis: Another process has already opened the file.) 95 # (hypothesis: Another process has already opened the file.)
96 _logger.info('Got exception (%s) ' % error) 96 _logger.info('Got exception (%s) ' % error)
97 97
98 if sys.platform == 'win32': 98 if sys.platform == 'win32':
99 handle_file = r'E:\handle.exe' 99 handle_file = r'E:\handle.exe'
100 if os.path.exists(handle_file): 100 if os.path.exists(handle_file):
101 _logger.info('Running handle.exe for debugging purposes') 101 _logger.info('Running handle.exe for debugging purposes')
102 subprocess.call([handle_file]) 102 subprocess.call([handle_file])
103 else: 103 else:
104 _logger.info("Couldn't find %s. Not printing open handles." 104 _logger.info("Couldn't find %s. Not printing open handles."
105 % handle_file) 105 % handle_file)
106 raise error 106 raise error
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698