![]() ![]() Or a combination since you are trying to use old stuff that maybe isn’t fully compatible. And that weirdness could be tied to the newer use of a different default server where ‘jupyter-notebook’ vs. And then if you know you need specific versions, then try pinning and see if things still work.) But that sort of makes since you are using a year-old version of Voila and ipywidgets version 7 had a lot of issues fixed in ipywidgets version 8. (It’s always best to leave things unpinned and check if things work. The only weirdness I see is that by using old versions of things in your requirements.txt, you’ve somehow broken things working in JupyterLab. Wait, as long as you don’t try to run you code in JupyterLab, switching to the Voila interface from inside the JupyterLab interface allows your adapted code to work, too. docx extension gets added when saving to my machine even though I cannot see it when I specify the file name in the download panel. docx files with whatever I typed in the text input form. In the Voila rendering, I was able to create and download. Then I click on the Voila button on the toolbar above. ) Then in classic mode I made a new notebook using the ‘ New’ dropdown on the upper, right side and pasted in your code. I just tested it by launching via here (it’s using your repo here) and then switching to classic mode using the ‘Help’ menu of JupyterLab. The function has an optional delete prompt so you can delete the file after download to keep the notebook server clean. It makes it much easier for others to test what you are working on in the same environment as you. A function that creates a csv download link, based on Coen Jonkers answer and similar to Yasin Zähringers answer except that it uses so that there is no need to create html code. Your adapted code works in launches from MyBinder.Īre you sure you don’t have pop-up blocker or virus blocker on?Īnd please when you have a public repo you are working in trying to get things to work on MyBInder, share the link to the repo and the launch URL. Trigger_download(content, w1.value + '.docx') With open(w1.value + '.docx', 'rb') as f: ![]() Here is my code that I put in a new notebook, and then hit the voila icon in the upper right side to try it in Voila: # based on įrom IPython.display import HTML, clear_outputĭef trigger_download(text, filename, kind='text/json'):Ĭontent_b64 = b64encode(text.encode()).decode()ĭata_url = f'data:') Then when the session came up I used JupyterLab’s file navigator to duplicate voilademo.py and renamed it to voilademo.txt. I clicked here to open a session (happened to be based on this repo here, but that isn’t really important as it didn’t use the method they tried in the notebook there). Here is my set-up preparing for the demo. Yes, and on that page there is an example here that agoose says works in voila and I just tested a variation of it. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |