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

Running sample notebook fails with error "Permission Denied" #41

Open
nluetts opened this issue Nov 15, 2024 · 4 comments
Open

Running sample notebook fails with error "Permission Denied" #41

nluetts opened this issue Nov 15, 2024 · 4 comments

Comments

@nluetts
Copy link

nluetts commented Nov 15, 2024

Describe the bug
Running OpticSim.NotebooksUtils.run_sample("EmittersIntro.jl") fails with error "Permission Denied"

To Reproduce
Steps to reproduce the behavior:

mkdir myproject && cd myproject
julia
julia> ]activate .
julia> ]add OpticSim
julia> using OpticSim
julia> OpticSim.NotebooksUtils.run_sample("EmittersIntro.jl")
┌ Info: Copying the sample notebook [EmittersIntro.jl] from the samples directory to the current one
│ /home/nluetts/.julia/packages/OpticSim/gelEh/samples/notebooks/EmittersIntro.jl ->/tmp/myproject/EmittersIntro.jl
[ Info: Running sample notebook from [/tmp/myproject/EmittersIntro.jl]
[ Info: Launching Notebook [/tmp/myproject/EmittersIntro.jl]
ERROR: SystemError: opening file "/tmp/myproject/EmittersIntro.jl": Permission denied

Expected behavior
Running OpticSim.NotebooksUtils.run_sample("EmittersIntro.jl") opens Pluto and let's you play with the example

Desktop (please complete the following information):

  • OS: Fedora 40
  • Julia version 1.10.6
  • OpticSim.jl version 0.6.0

Additional context

The problem is that the created file has no write permissions:

[nluetts@fedora myproject]$ ll
total 292
-rw-r--r--. 1 nluetts nluetts 95212 Nov 15 10:21 'EmittersIntro backup 1.jl'
-r--r--r--. 1 nluetts nluetts 95212 Nov 15 10:21  EmittersIntro.jl
-rw-r--r--. 1 nluetts nluetts 94886 Nov 15 10:13  Manifest.toml
-rw-r--r--. 1 nluetts nluetts    57 Nov 15 10:13  Project.toml

Manually setting chmod +w EmittersIntro.jl fixes the problem.

I guess you could add a call to Base.Filesystem.chmod after this line:

but I am not sure if that would be cross-platform.

@brianguenter
Copy link
Owner

Have you tried that fix? If it works submit a PR and I'll test it on my machine. Then we'll know it works on Fedora and Windows.

@nluetts
Copy link
Author

nluetts commented Nov 20, 2024

Yes, it fixes the error, but the notebook does not run through, it errors out when loading PlutoUI.jl and DataFrames.jl, because those are not part of my test project. So I guess you should opt into the Pluto package management or create a folder including a Project.toml/Manifest.toml + the sample notebook instead of merely copying the notebook file.

@brianguenter
Copy link
Owner

Sorry for the delayed response, we had a bomb cyclone hit our state. Power and internet went out for 500,000 people.

Last time I checked Pluto package management could be extremely slow, since it didn't cache anything from previous runs of Pluto. Has this changed with the release of 1.11?

@nluetts
Copy link
Author

nluetts commented Nov 25, 2024

I am not sure, since I am not a regular user of Pluto. In that case, however, you could change the mere copy of the notebook to creation of a dedicated directory, see my previous comment. Either way, project management should be added somehow, or you could add a note to the docs of run_sample() saying that the user has to create the project themself.

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

2 participants