Do not save json if write permission is not set
This commit is contained in:
parent
c1bf8135c3
commit
a242c505cc
|
@ -81,8 +81,11 @@ class Command(BaseCommand):
|
|||
contents = [contents]
|
||||
self.do(contents=contents)
|
||||
contents = {"data": contents}
|
||||
with open(path, "w") as fd:
|
||||
json.dump(contents, fd, indent=4)
|
||||
try:
|
||||
with open(path, "w") as fd:
|
||||
json.dump(contents, fd, indent=4)
|
||||
except PermissionError:
|
||||
pass
|
||||
|
||||
def info(self, *args, **kwargs):
|
||||
if self.verbosity >= 1:
|
||||
|
|
Loading…
Reference in New Issue