Comments (10)
@andfanilo Can you run the following in your terminal and share the output?
python -c "import mimetypes; print (mimetypes.guess_type('lunr.js'))"
It should return ('application/javascript', None)
If not, can you try the instructions here? But create the mime type for javascript not for pdf
from docs.
Hmm it works for me locally
- Mac, Firefox
- Python 3.7.4
- Streamlit 0.57.3
And on my Windows VM
- Windows 10, Firefox
- Python 3.8
- Streamlit 0.57.3
from docs.
It is working fine also for me:
- Mac, Chrome & Firefox
- Python 3.8.2
- Streamlit 0.57.3
from docs.
Works like a charm, thanks @jrhone ! Guess one of my IDEs wanted to have fun with file extensions...
from docs.
Well, seems like Firefox added some new security features and your OS didn't have Mime Types configured correctly.
I wonder if we should add this to the documentation somewhere or automate this check if possible and provide a warning to the user.
Going to re-open for now so we can address the scenario fully.
Thanks for confirming the fix!
from docs.
This may explain things, so for other readers I was on Firefox 75 here and python -c "import mimetypes; print (mimetypes.guess_type('lunr.js'))"
returned text/plain
.
from docs.
Going to close this, since it hasn't come up again since I've been at the company. Obviously, if people start mentioning this again, we can add a note to the docs
from docs.
Graphviz not showing in Chrome (Version 80.0.3987.132 (Official Build) (64-bit) ).
Code built from Visual Studio Code on Windows 10 machine.
Code used was from https://docs.streamlit.io/en/stable/api.html#streamlit.graphviz_chart
Running python -c "import mimetypes; print (mimetypes.guess_type('lunr.js'))" in console returned "text/plain"
Registry changes
.js node was present under "HKEY_LOCAL_MACHINE" at Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Classes.js
I added "ContentType" key with a value of 'application/javascript'
Re-tested with no effect. Opened a new command prompt and re-ran python -c "import mimetypes; print (mimetypes.guess_type('lunr.js'))" which returned "text/plain"
.js node was present in "HKEY_CURRENT_USER" at Checked Computer\HKEY_CURRENT_USER\SOFTWARE\Classes.js
and it had these values "ContentType" = 'text/plain' and "PerceivedType" = 'text'
Changed the ContentType value to 'application/javascript'
Re-tested with no effect. Opened a new command prompt and re-ran python -c "import mimetypes; print (mimetypes.guess_type('lunr.js'))" which returned "text/plain"
Re-set the registry back to the initial position
I ran the app in (chromium) version of Edge and the graph(s) shows as expected
addendum...
Please note in the change in the registry to set .js files to "application/javascript" will allow .js files to run on a machine on a double-click and this has security issues (which is why the mime type for .js files is to "plain text" on my machine). My home laptop has no mimetype set for .js and the graph displays as expected in Chrome (unsure if its version however). If that helps.
Update
Now I find that despite root, local machine and user class entries in registry have .js set to 'application/javascript' Microsoft Edge and Chrome no longer displays the GraphViz graphs
from docs.
This failed for me with the above symptoms as well.
Windows 10 PC
streamlit 0.76.0
The HKEY_LOCAL_MACHINE/Software/Classes/.js key was correct, but a HKEY_CURRENT_USER/Software/Classes/.js key was "text/plain". I changed this in the registry.
Now the python script reports "('application/javascript', None)". Chrome and Firefox display the chart. But this still fails in the same way in Microsoft Edge (which is what I use by default).
Edge 88.0.705.63
Chrome Version 88.0.4324.150
Javascript console errors in Edge are:
4fc2c1f8-4a0c-487a-8f3f-1c1cc2f7ae8c:4 Refused to execute script from 'http://localhost:8501/vendor/viz/viz-1.8.0.min.js' because its MIME type ('text/plain') is not executable.
onmessage @ 4fc2c1f8-4a0c-487a-8f3f-1c1cc2f7ae8c:4
4fc2c1f8-4a0c-487a-8f3f-1c1cc2f7ae8c:4 Uncaught DOMException: Failed to execute 'importScripts' on 'WorkerGlobalScope': The script at 'http://localhost:8501/vendor/viz/viz-1.8.0.min.js' failed to load.
at onmessage (blob:http://localhost:8501/4fc2c1f8-4a0c-487a-8f3f-1c1cc2f7ae8c:4:21)
15.4f7ab330.chunk.js:1 Uncaught Viz is not defined
from docs.
Closing this issue as one already exists in the Streamlit library repo: streamlit/streamlit#3887
from docs.
Related Issues (20)
- Docs show python version selector for Community Cloud that doesn't seem to exist HOT 1
- Typo in example code HOT 4
- Typo in Documentation: "tase" should be "taste" HOT 2
- Incorrect documentation about new widget return value
- Search st.html goes to page not found HOT 1
- Wrong default light theme values
- Spelling Error `worksapce` → `workspace`
- Typo/spelling error in trigger-a-full-script-rerun-from-a-fragment.md
- Over resource limits on Streamlit Cloud HOT 1
- Unable to access locally deployed documents via ip:port HOT 1
- State in the docs that the contents of a st.Page must be on root level
- "Contributing" instructions for Linux are outdated/incomplete HOT 5
- Over resource limits on Streamlit Cloud HOT 1
- Wrong Dockerfile configuration on Deploy Streamlit using Docker docs page HOT 2
- Streamlit App API calls HOT 2
- E: Unable to locate package python-openssl HOT 1
- Code in headers displays as a block
- st.cache_data documentation should specify that information is cached globally
- st.popover examples erroring out HOT 2
- st.popover examples in docs give an error HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docs.