Using webbrowser Python module in Dataiku recipes/plugins
Hi,
I am currently using Dataiku Version 9.0.3.
I was trying to develop a plugin when I realise that - using the Python module: webbrowser to open url only works on Dataiku installed on my local machine.
I realised that if I do it on Dataiku installed on the cloud like Azure VM, the recipe or plugin using webbrowser will succeed without error but it won't show a new tab/window for the browser, and to test it out as screenshot below: the print statements also returns as False - which means that the browser was unable to open in the environment.
Does anyone have any workarounds or ideas to overcome this? Thank you and your help is highly appreciated!
Answers
-
Alexandru Dataiker, Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered Posts: 1,226 Dataiker
Indeed the webbrowser module will only work if DSS is running on locally, since will essentially make a call similar to "python -m webbrowser -t "http://www.python.org" on the dss server. This will not do anything on the DSS server since the browser is not found. If a browser was found it would open the browser on the DSS server not for the end user.
Overall opening a browser window from DSS plugin is not possible.
You can however use a Webapp instead of a plugin to open a new tab either in Javascript or HTML https://doc.dataiku.com/dss/latest/webapps/index.html
By executing : window.open("https://www.w3schools.com") in JS.
Hope this helps.