I ran into this discussion (Notifications with templates) when I discovered the error in my project and have a similar yet different issue. When running code that utilizes the notifications feature in a script (.py), everything works fine. But running that same code in a Jupyter notebook does not display any notifications.
For example:
if df.empty:
print("Dataframe is empty/Cannot read file")
pn.state.notifications.error('Error!', duration = 4000)
return
The above code will work when running in a script file using .servable(), but I can’t get anything to appear when running in a notebook, not even the example code from the Panel docs:
pn.state.notifications.error('This is an error notification.', duration=1000)
This will only print the attributes of the ‘notifications’ module.
What is especially weird is that the only thing that does produce a popup is using the .demo() method mentioned in the Panel docs:
pn.io.notifications.NotificationArea.demo()
Can anyone reproduce this or let me know what I’m missing?