-
Notifications
You must be signed in to change notification settings - Fork 106
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
Plot show
Method Not Working on Windows 10
#132
Comments
Just thought I'd leave an addendum here, I think there could be some kind of versioning issue because per #131 this should be fixed but unfortunately this appears to still be an issue as of version |
Edit: Updated description within PR, but may be duplicate of #129 if updated |
Confirmed not working on Windows 11 as well. |
I have the same problem. I didn't try this out here, but in my own project and using #[cfg(target_os = "windows")]
fn show_with_default_app(temp_path: &str) {
use std::process::Command;
Command::new("explorer")
.arg(temp_path)
.output()
.expect(DEFAULT_HTML_APP_NOT_FOUND);
} should technically work? edit: Oh, just noticed the PR - if #133 works fine, then that's great! |
@mfreeborn just tried it out and the plot is opened without any problems in the browser on Windows 11 :D |
Don’t work out the box on my Windows 11. Seems like a problem with temp files, if I supply my own html file, it works fine. I use this workaround for now. |
…#133) * Changes to `show` method for Windows * `CHANGELOG.md` PR credits updated
Windows 11 23H2 Since Seems like the current Windows implementation for Minimal example to demonstrate error: fn main() {
let plot = plotly::Plot::new();
plot.show_html("te&st.html");
} (on a Windows machine) Returns a
The current implementation Lines 485 to 492 in 7bfae55
uses cmd /C start '.\te&st.html' which for some reason not known to me interprets the & in the filename as the separator between current and next command
Using It's technically a different issue to this one, but kinda adjacent imo |
This seems to be a Windows specific parsing problem, not a @fsktom, I have no way of testing on Windows. Could you try the suggestion in that answer, prepending the path with |
Yeah, it's most definitely a Windows issue, just wanted to mention it here since it will occur if you use a file path with an ampersand on Windows. We could just say to not use @andrei-ng thanks for doing this bit of research, I've tried it out and... it's weird (like everything with Windows...). Command I used:
Executing this command in PowerShell or via
Changing #[cfg(target_os = "windows")]
fn show_with_default_app(temp_path: &str) {
use std::process::Command;
Command::new("explorer")
.arg(temp_path)
.spawn()
.expect(DEFAULT_HTML_APP_NOT_FOUND);
} |
Thanks for looking into it further. I hoped that there was a quick workardound somehow. But indeed ... Windows ... nothing is simple. I think we should keep all the discussion here and not open a new issue (to reply to a previous comment of yours). They are not one and the same issue, but kind of related. |
MWE is given from excerpt within
plot.rs
:Expected: Generated HTML to be opened using the user's default browser.
Actual: System exits with code 0, though no process is spawned/made apparent.
At a glance the issue here seems to be with the parameters used when attempting to open the browser and more specifically their formatting (possibly a quirk of using the older syntax affected by the now closed issue #29494 or alternatively, regarding how the
output
method is being handled on Windows).As an aside I'd imagine this probably went undetected for some time courtesy of:
but this is just speculation and fortunately this can be hastily remedied and I'll open a PR for shortly.
Thanks! ❤️
The text was updated successfully, but these errors were encountered: