Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BytesIO/StringIO break pn.pane.image if called second time #1711

Closed
hoxbro opened this issue Oct 27, 2020 · 0 comments · Fixed by #1716
Closed

BytesIO/StringIO break pn.pane.image if called second time #1711

hoxbro opened this issue Oct 27, 2020 · 0 comments · Fixed by #1716
Labels
type: bug Something isn't correct or isn't working
Milestone

Comments

@hoxbro
Copy link
Member

hoxbro commented Oct 27, 2020

ALL software version info

Panel: 0.10.0.post7+gb5cf6928

Description of expected behavior and the observed behavior

When having a BytesIO/StringIO object as input to pn.pane.image it will crash the second time a widget is called.
I don´t know if it a feature or a bug... I have made a simple implementation of a fix, if it is a bug here.

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

import os

import param
import panel as pn


class ImageExample(param.Parameterized):
    def __init__(self, **params):
        self.button = pn.widgets.Button(name="Create Animation", button_type="primary")
        self.break_ = pn.widgets.Button(name="Break Animation", button_type="primary")
        super().__init__(**params)
        self.gif = None

    @param.depends(pn.state.param.busy)
    def animation(self, busy):
        return None if busy else self.gif

    @param.depends("button.clicks")
    def _create_animation(self):
        # it could be any gif... :)
        self.gif = pn.pane.GIF(open(os.path.join(os.path.dirname(__file__),'index.gif'), 'rb'))

    @param.depends("break_.clicks")
    def _break_animation(self):
        pass


ie = ImageExample()
pn.Column(
    ie.button,
    ie.break_,
    ie.animation,
    ie._create_animation,
).servable()

Screenshots or screencasts of the bug in action

bug

@hoxbro hoxbro changed the title BytesIO/StringIO crashes pn.pane.image if called second time. BytesIO/StringIO crashes pn.pane.image if called second time Oct 27, 2020
@hoxbro hoxbro changed the title BytesIO/StringIO crashes pn.pane.image if called second time BytesIO/StringIO break pn.pane.image if called second time Oct 27, 2020
@philippjfr philippjfr added the type: bug Something isn't correct or isn't working label Oct 28, 2020
@philippjfr philippjfr added this to the v0.10.x milestone Oct 28, 2020
@philippjfr philippjfr removed this from the v0.10.x milestone Nov 1, 2020
@philippjfr philippjfr added this to the v0.10.2 milestone Nov 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't correct or isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants