I’m trying to understand why I can see the pathname in the browser, but not programmatically. Let me show you what I see:
Now, that’s coming from pn.Row(..., pn.state.location).servable()
It has all the information I wanna see, its great, but when I run print('pn.state.location.pathname', pn.state.location.pathname)
it’s empty; let me show you:
very confusing to me. Is this normal, or is this a bug? If it’s normal, is there any way to access the pathname, (or any of the other attributes) programmatically?
Here’s my full notebook, which is served via panel serve
, then shown in an iframe through a flask app:
import panel as pn
widget = pn.widgets.FloatSlider(name='Slider', start=0, end=10)
widget2 = pn.widgets.TextInput(name='Text')
widget3 = pn.widgets.RangeSlider(name='RangeSlider', start=0, end=10)
widget4 = pn.widgets.TextInput(name='Text')
if pn.state.location:
print('pn.state.location.pathname', pn.state.location.pathname)
print(type(pn.state.location.pathname))
pn.state.location.sync(widget, {'value': 'slider_value'})
pn.state.location.sync(widget2, {'value': 'text_value'})
pn.state.location.sync(widget3, {'value': 'range_value'})
widget4.param.value = pn.state.location.pathname
pn.Row(widget, widget2, widget3, widget4, pn.state.location).servable()