Open zsunberg opened 7 years ago
Tasks are
Unfortunately I have no idea about how to make the browser load a script from a local file - I think it is a security hazard of some kind. I've done a fair amount of googling, but javascript development for offline use is not a popular topic, so I am not going to fix it until I can talk to someone who has lots of javascript/jupyter experience :(.
The issue is similar to this: https://github.com/JuliaLang/IJulia.jl/issues/345
Maybe it can be fixed with this https://github.com/EricForgy/Pages.jl
When I used D3Tree, I find a problem but I can't solve it. Perhaps you can help me to solve it. Thank you very much!
Here's my question:
Traceback (most recent call last):
File "C:/Users/pilgrim/Desktop/code/effecitive_python.py", line 7, in cmd /C start chrome 'C:\Users\pilgrim\AppData\Local\Temp\jl_vy8tX5\tree.html'
: no such file or directory (ENOENT)
Stacktrace:
[1] _spawn_primitive(::String, ::Cmd, ::Array{Any,1}) at .\process.jl:99
[2] #550 at .\process.jl:112 [inlined]
[3] setup_stdios(::Base.var"#550#551"{Cmd}, ::Array{Any,1}) at .\process.jl:196
[4] _spawn at .\process.jl:111 [inlined]
[5] run(::Cmd; wait::Bool) at .\process.jl:439
[6] run at .\process.jl:438 [inlined]
[7] inchrome(::D3Tree) at C:\Users\pilgrim.julia\packages\D3Trees\CDEyE\src\displays.jl:15
[8] top-level scope at C:\Users\pilgrim\Desktop\code\test.jl:10
[9] include(::String) at .\client.jl:439
[10] #invokelatest#1 at .\essentials.jl:712 [inlined]
[11] invokelatest(::Any, ::Any) at .\essentials.jl:711
[12] _pyjlwrap_call(::Function, ::Ptr{PyCall.PyObject_struct}, ::Ptr{PyCall.PyObject_struct}) at C:\Users\pilgrim.julia\packages\PyCall\zqDXB\src\callback.jl:28
[13] pyjlwrap_call(::Ptr{PyCall.PyObject_struct}, ::Ptr{PyCall.PyObject_struct}, ::Ptr{PyCall.PyObject_struct}) at C:\Users\pilgrim.julia\packages\PyCall\zqDXB\src\callback.jl:49
in expression starting at C:\Users\pilgrim\Desktop\code\test.jl:10
I only use the function: inchrome.
@pilgrimygy it looks like your system was not able to start chrome. Do you have google chrome installed and does the command start chrome
work in the command line?
If you have a different browser installed, consider using inbrowser
instead of inchrome
.
Oh! Thank you very much! I can print the tree in jupyter notebook.
------------------ 原始邮件 ------------------ 发件人: "sisl/D3Trees.jl" <notifications@github.com>; 发送时间: 2020年7月15日(星期三) 晚上11:55 收件人: "sisl/D3Trees.jl"<D3Trees.jl@noreply.github.com>; 抄送: "pilgrim"<969285114@qq.com>;"Comment"<comment@noreply.github.com>; 主题: Re: [sisl/D3Trees.jl] Offline (#10)
If you have a different browser installed, consider using inbrowser instead of inchrome.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.
Unfortunately I have no idea about how to make the browser load a script from a local file - I think it is a security hazard of some kind.
Yeah, this limitation is borne out of CORS rules: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
The fix is easy, just serve all the files from a local Web server.
If you're targeting just the Chromium/Chrome browser, a possible workaround is to specify the --disable-web-security
command line flag when starting the Chromium process: https://peter.sh/experiments/chromium-command-line-switches/#disable-web-security
Another workaround, but not just for Chromium, would be to include the JS and other dependencies in the HTML file that you generate.
Thanks for the clarifying comments @nsajko ! I don't have time to personally work on this at the moment, but it would be nice for someone to implement one of these ideas. Would prefer something that works in all browsers and Jupyter.
Right now the package downloads d3 on the fly, so it will not work without the internet, as I found out painfully in a presentation. I guess we should download d3 into deps