Skip to content
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

Use tempfile module to create temporary file for offline.plot #395

Closed
joshburkart opened this issue Jan 31, 2016 · 4 comments
Closed

Use tempfile module to create temporary file for offline.plot #395

joshburkart opened this issue Jan 31, 2016 · 4 comments

Comments

@joshburkart
Copy link
Contributor

Right now the default file that plotly.offline.plot outputs to is temp-plot.html in the current working directory. I think it would be better to create a real temporary file using e.g. tempfile.NamedTemporaryFile so as not to pollute the current working directory?

Happy to contribute this myself but thought I'd test the waters first. :)

@joshburkart
Copy link
Contributor Author

Another advantage would be avoiding the situation where you make two calls to plot in one script without specifying a file, and two browser windows are naturally opened up, but often both contain the second plot.

@chriddyp
Copy link
Member

hey @joshburkart -
I'm a bit hesitant to use random filenames or temporary files because I think some users could accidentely fill up their hard-drive with a bunch of temporary plot files:

while True:
   plot(figure) # no filename specified - if we create a random filename, then this will create a new file on every iteration

Is my understanding of tempfile correct here?

Another advantage would be avoiding the situation where you make two calls to plot in one script without specifying a file, and two browser windows are naturally opened up, but often both contain the second plot.

I totally agree with you on this - it's really easy to accidentely overwrite a file the way we have it set up right now.

I'm open to other suggestions!

@jonmmease
Copy link
Contributor

Let's revisit this as a configuration option when get to working on the plotly.io.show module (#1098)

@gvwilson
Copy link
Contributor

Hi - this issue has been sitting for a while, so as part of our effort to tidy up our public repositories I'm going to close it. If it's still a concern, we'd be grateful if you could open a new issue (with a short reproducible example if appropriate) so that we can add it to our stack. Cheers - @gvwilson

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

No branches or pull requests

4 participants