Show More
@@ -159,6 +159,15 b' class abstractopener(object):' | |||
|
159 | 159 | '''Prevent instantiation; don't call this from subclasses.''' |
|
160 | 160 | raise NotImplementedError('attempted instantiating ' + str(type(self))) |
|
161 | 161 | |
|
162 | def tryread(self, path): | |
|
163 | 'gracefully return an empty string for missing files' | |
|
164 | try: | |
|
165 | return self.read(path) | |
|
166 | except IOError, inst: | |
|
167 | if inst.errno != errno.ENOENT: | |
|
168 | raise | |
|
169 | return "" | |
|
170 | ||
|
162 | 171 | def read(self, path): |
|
163 | 172 | fp = self(path, 'rb') |
|
164 | 173 | try: |
General Comments 0
You need to be logged in to leave comments.
Login now