Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4021cd0

Browse files
committed
raise plotly error if users try to write to files without permission.
1 parent 938baf7 commit 4021cd0

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

plotly/tools.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ def set_credentials_file(username=None, api_key=None, stream_ids=None):
7676
"""Set the keyword-value pairs in `~/.plotly_credentials`.
7777
7878
"""
79+
if not _file_permissions:
80+
raise exceptions.PlotlyError("You don't have proper file permissions "
81+
"to run this function.")
7982
ensure_local_plotly_files() # make sure what's there is OK
8083
credentials = get_credentials_file()
8184
if isinstance(username, (str, unicode)):
@@ -133,6 +136,9 @@ def set_config_file(plotly_domain=None, plotly_stremaing_domain=None):
133136
"""Set the keyword-value pairs in `~/.plotly/.config`.
134137
135138
"""
139+
if not _file_permissions:
140+
raise exceptions.PlotlyError("You don't have proper file permissions "
141+
"to run this function.")
136142
ensure_local_plotly_files() # make sure what's there is OK
137143
settings = get_config_file()
138144
if isinstance(plotly_domain, (str, unicode)):

0 commit comments

Comments
 (0)