def display(self, format="png"):
        from sebastian.core.transforms import lilypond
        seq = HSeq(self) | lilypond()

        lily_output = write_lilypond.lily_format(seq)
        if not lily_output.strip():
            #In the case of empty lily outputs, return self to get a textual display
            return self

        if format == "png":
            suffix = ".preview.png"
            args = ["lilypond", "--png", "-dno-print-pages", "-dpreview"]
        elif format == "svg":
            suffix = ".preview.svg"
            args = ["lilypond", "-dbackend=svg", "-dno-print-pages", "-dpreview"]

        f = tempfile.NamedTemporaryFile(suffix=suffix)
        basename = f.name[:-len(suffix)]
        args.extend(["-o" + basename, "-"])

        #Pass shell=True so that if your $PATH contains ~ it will
        #get expanded. This also changes the way the arguments get
        #passed in. To work correctly, pass them as a string
        p = sp.Popen(" ".join(args), stdin=sp.PIPE, shell=True)
        stdout, stderr = p.communicate("{ %s }" % lily_output)
        if p.returncode != 0:
            # there was an error
            #raise IOError("Lilypond execution failed: %s%s" % (stdout, stderr))
            return None

        if not ipython:
            return f.read()
        if format == "png":
            return Image(data=f.read(), filename=f.name, format="png")
        else:
            return SVG(data=f.read(), filename=f.name)
Process the event.
dataset/ETHPy150Open jtauber/sebastian/sebastian/core/elements.py/SeqBase.display--crossover with--dataset/ETHPy150Open jdswinbank/Comet/comet/icomet.py/IValidator.__call__