Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 81639a1 commit 8335773Copy full SHA for 8335773
lib/matplotlib/__init__.py
@@ -217,7 +217,24 @@ def _is_writable_dir(p):
217
p + '' # test is string like
218
except TypeError:
219
return False
220
- return os.access(p, os.W_OK) and os.path.isdir(p)
+
221
+ # Test whether the operating system thinks it's a writable directory.
222
+ # Note that this check is necessary on Google App Engine, because the
223
+ # subsequent check will succeed even though p may not be writable.
224
+ if not os.access(p, os.W_OK) or not os.path.isdir(p):
225
+ return False
226
227
+ # Also test that it is actually possible to write to a file here.
228
+ try:
229
+ t = tempfile.TemporaryFile(dir=p)
230
231
+ t.write(ascii('1'))
232
+ finally:
233
+ t.close()
234
+ except OSError:
235
236
237
+ return True
238
239
class Verbose:
240
"""
0 commit comments