holoviz / panel

Panel: The powerful data exploration & web app framework for Python
https://panel.holoviz.org
BSD 3-Clause "New" or "Revised" License
4.8k stars 519 forks source link

AttributeError: module 'panel' has no attribute 'save'. Did you mean: 'serve'? #7511

Closed MarcoGorelli closed 1 day ago

MarcoGorelli commented 1 day ago

I've tried following the instructions in https://panel.holoviz.org/how_to/export/saving.html, but I get

Traceback (most recent call last):
  File "/home/marcogorelli/scratch/simple_panel.py", line 7, in <module>
    pn.save('test.png')
    ^^^^^^^
AttributeError: module 'panel' has no attribute 'save'. Did you mean: 'serve'?

What I'm trying to do is to, in CI, capture what a Panel app looks like and save it as artifact. From reading https://panel.holoviz.org/how_to/export/saving.html, it looks like panel.save should do this - but if I try, I get that panel has no such attribute

ALL software version info

(this library, plus any other relevant software, e.g. bokeh, python, notebook, OS, browser, etc should be added within the dropdown below.)

Software Version Info ```plaintext panel==1.5.4 ```

Description of expected behavior and the observed behavior

Complete, minimal, self-contained example code that reproduces the issue

# code goes here between backticks
import panel as pn

pn.extension()

pn.panel("Hello World").servable()

pn.save('test.png')

Stack traceback and/or browser JavaScript console output

Screenshots or screencasts of the bug in action

MarcoGorelli commented 1 day ago

Ah got it, panel is the name of the object, not the Python module

import panel as pn

pn.extension()

from bokeh.resources import INLINE
pn.panel("Hello World").save('test.html', resources=INLINE)

works fine