Skip to content

Allow user to set plotly directory as environment variable #533

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
synzhu opened this issue Aug 7, 2016 · 2 comments
Closed

Allow user to set plotly directory as environment variable #533

synzhu opened this issue Aug 7, 2016 · 2 comments
Assignees
Milestone

Comments

@synzhu
Copy link

synzhu commented Aug 7, 2016

It would be very convenient if there were a way to set the plotly directory in the PLOTLY_DIR environment variable, or default to ~/.plotly if the variable is not set. It can be easily done by changing line 4 here: https://github.com/plotly/plotly.py/blob/master/plotly/files.py
to the following:

PLOTLY_DIR = os.environ.get("PLOTLY_DIR", os.path.join(os.path.expanduser("~"), ".plotly"))

Then, to specify a custom plotly directory when running a script which uses the plotly module, we can do PLOTLY_DIR=/path/to/plotly_dir python script_that_uses_plotly.py

@ladhani
Copy link

ladhani commented Feb 24, 2018

Also a big headacke getting plotly running with Microsoft IIS on Windows Server using CGI binding with python.exe. As home directory will be pointing to some subfolder under windows system folder. So a no-no for writing .plotly and .testing subfolders!!!

I made the following ugly change in files.py:


import os

file structure

#PLOTLY_DIR = os.path.join(os.path.expanduser("~"), ".plotly")
#CREDENTIALS_FILE = os.path.join(PLOTLY_DIR, ".credentials")
#CONFIG_FILE = os.path.join(PLOTLY_DIR, ".config")

#TEST_DIR = os.path.join(os.path.expanduser("~"), ".test")
#TEST_FILE = os.path.join(PLOTLY_DIR, ".permission_test")

#Changed by Al-Noor

PLOTLY_DIR = ".plotly"
CREDENTIALS_FILE = os.path.join(PLOTLY_DIR, ".credentials")
CONFIG_FILE = os.path.join(PLOTLY_DIR, ".config")

TEST_DIR = ".plotly_test"
TEST_FILE = os.path.join(PLOTLY_DIR, ".permission_test")

So now ,plotly folders are made in the Web folder where IIS User has permission to write/read.

And now I can use plotly on Microsoft 2016 server with IIS and Python via CGI.

But it would be better to have a more clean solution, I think!
(local accounts now get the ,plotly folders in each of their local directory where they run py with plotly.

I will submit this issue / feature request to plotly.

@jonmmease
Copy link
Contributor

Done in #1195. If present, the PLOTLY_DIR environment variable is taken as the path to the plotly.py configuration directory. If not present, the path remains ~/.plotly.

I know it's been a while, but thanks for the suggestion @simon-zhu!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants