Skip to content

Commit 132ac9c

Browse files
authored
Merge pull request plotly#734 from daliati/master
v2.0.8 only write config file if changed
2 parents 8eafa68 + 8114937 commit 132ac9c

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

plotly/tools.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ def ensure_local_plotly_files():
8383
for fn in [CREDENTIALS_FILE, CONFIG_FILE]:
8484
utils.ensure_file_exists(fn)
8585
contents = utils.load_json_dict(fn)
86+
contents_orig = contents.copy()
8687
for key, val in list(FILE_CONTENT[fn].items()):
8788
# TODO: removed type checking below, may want to revisit
8889
if key not in contents:
@@ -91,7 +92,12 @@ def ensure_local_plotly_files():
9192
for key in contents_keys:
9293
if key not in FILE_CONTENT[fn]:
9394
del contents[key]
94-
utils.save_json_dict(fn, contents)
95+
# save only if contents has changed.
96+
# This is to avoid .credentials or .config file to be overwritten randomly,
97+
# which we constantly keep experiencing
98+
# (sync issues? the file might be locked for writing by other process in file._permissions)
99+
if contents_orig.keys() != contents.keys():
100+
utils.save_json_dict(fn, contents)
95101

96102
else:
97103
warnings.warn("Looks like you don't have 'read-write' permission to "

plotly/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '2.0.7'
1+
__version__ = '2.0.8'

0 commit comments

Comments
 (0)