def read(self):
        """Checks if anything has arrived in the pipe file, returns list of
        (command,show,content) tuples.
        Special tags added in comment() above are replaced.
        """
        # read file is set to None on error, so that we stop reading
        if self.pipefile_read is None:
            return []
        # no pipe -- read nothing
        if not os.path.exists(self.pipefile):
            return []
        # move pipe file out of the way before we start reading from it
        try:
            os.rename(self.pipefile, self.pipefile_read)
        except:
            print("Error renaming %s to %s:" % self.pipefile, self.pipefile_read)
            traceback.print_exc()
            self.pipefile_read = None
            return []
        # now read everything
        try:
            lines = open(self.pipefile_read).readlines()
        except:
            print("Error reading %s:" % self.pipefile_read)
            traceback.print_exc()
            self.pipefile_read = None
            return []
        # parse lines
        cmds = []
        for line in lines:
            tokens = line.rstrip().split(":", 2)
            if len(tokens) < 3:
                continue
            command, show, content = tokens
            # convert 'show' to bool
            try:
                show = bool(int(show))
            except:
                show = False
            # if 'comment' command, parse content string
            if command == "comment":
                # <BR> inserts new paragraph (double-newline)
                content = content.replace("<BR>", "\n\n")
                # <NOBR> blocks newline at end, which is otherwise implictly added...
                if content.endswith("<NOBR>"):
                    content = content[:-6]
                # ...here
                elif not content.endswith("\n"):
                    content += "\n"
            # add to list of contents
            # print "read %s:%d:%s:"%(command,show,content)
            cmds.append((command, show, content))
        return cmds