JuliaPluto / PlutoSliderServer.jl

Web server to run just the `@bind` parts of a Pluto.jl notebook
https://computationalthinking.mit.edu/
The Unlicense
130 stars 17 forks source link

PlutoSliderServer on Windows #102

Open VivaldoMendes opened 1 year ago

VivaldoMendes commented 1 year ago

Hi, I am trying to use PlutoSliderServer for the first time. I created a Julia environment that I called plutoserver, then I did add PlutoSliderServer. Apparently, the installation went smoothly. I tried the first example on the website, and I got the message:

julia> path_to_notebook = download("https://raw.githubusercontent.com/fonsp/Pluto.jl/v0.17.2/sample/Interactivity.jl")
"C:\\Users\\UTILIZ~1\\AppData\\Local\\Temp\\jl_49sv0d6TwR"

julia> PlutoSliderServer.run_notebook("C:\\Users\\UTILIZ~1\\AppData\\Local\\Temp\\jl_49sv0d6TwR")
ERROR: AssertionError: PlutoSliderServer does not work on Windows yet!

Is the error message correct, or am I doing something wrong? Thanks

fonsp commented 1 year ago

Hey @VivaldoMendes !

Unfortunately we still don't support Windows :( But we are definitely interested in a PR if you are interested in contributing! The problem is with path separators for static URLs: the URL localhost:2345/a/b/c.html is mapped to the local file a/b/c.html. On Windows, this should map to a\b\c.html, and we don't have code to handle this yet.

For an implementation, be sure to use URIs.jl and joinpath, not just string replacements.

VivaldoMendes commented 1 year ago

Hi @fonsp, thanks for replying.

I have tested PlutoSliderServer on Linux (Ubuntu) as well. However, I kept doing something stupid. As far as I can understand, in Linux, the plutosliderserver seems to run OK and create the server, but then it spits out the following error:

error: Uncaught PermissionDenied: Permission denied (os error 13) about ["/tmp/systemd-private-ef8b2c2d7f1f40388db3325afb12e1dc-systemd-timesyncd.service-sNRh7g"]
    const watcher = Deno.watchFs("/tmp");
                         ^
    at new FsWatcher (deno:runtime/js/40_fs_events.js:19:23)
    at Object.watchFs (deno:runtime/js/40_fs_events.js:64:12)
    at file:///home/violeta/$deno$eval.js:1:26

I would be more than glad to help, but I wonder if I can be of much help. I know some cases where PlutoSliderServer works very well, e.g., @jbrea 's course here.

jbrea commented 1 year ago

If the sliderserver does not have write access to "/tmp" you could set the environment variable TEMP to some path it has write access to.

fonsp commented 1 year ago

@VivaldoMendes thanks for the report! Can you create a new issue and post your complete terminal log? Also post the output of:

# see permissions of the `/tmp` folder
ls -lha / | grep tmp
# try creating a temp file
touch /tmp/asdf.txt
VivaldoMendes commented 1 year ago

Hi @fonsp and @jbrea I did as you suggested and I had no problem to create the text file in the TEMP folder. The permissions are here:

violeta@violeta-QOSMIO-X70-B:~$ ls -lha / | grep tmp
drwxrwxrwt  19 root root  20K Mar 31 16:36 tmp
violeta@violeta-QOSMIO-X70-B:~$ touch /tmp/asdf.txt

Still not sure what is preventing the server to be reached.

Thanks