def load(self, path):
        '''Load a file given by the filename'''
        if self.path is None:
            raise Exception("nothing to load")

        self.dte.delete(1.0, "end")
        data = ""
        try:
            if path.startswith("http:") or path.startswith("https:"):
                f = urllib2.urlopen(self.path)
                data = f.read().replace("\r\n", "\n")
                f.close()
            else:
                if os.path.exists(self.path) or True:
                    f = open(self.path, "rU")
                    data = f.read().replace("\r\n", "\n")
                    f.close()
        except Exception, e:
            self.app.log.debug("error opening '%s': %s" % (self.path, str(e)))

        # hmmm; this will cause problems if the very last line
        # of a file ends in backspace-space. What's the
        # likelihood of that happening?
        data = data.rstrip()
        if data.startswith(codecs.BOM_UTF8):
            # N.B. visual studio creates utf-8 files with a
            # BOM as the first character.  We need to remove
            # the BOM, otherwise it will appear as a garbage
            # character in the text widget.
            data = data.decode("utf-8-sig")
            self.encoding="utf-8-sig"
        else:
            self.encoding="ascii"
        self.dte.insert(1.0, data)
        self.dte.edit_reset()
        self.dte.mark_set("insert", 1.0)
        self._checksum = self._compute_checksum()
        self._loaded = True
dataset/ETHPy150Open boakley/robotframework-workbench/rwb/editor/editor_page.py/EditorPage.load/original