I'm attempting to override a wxHtmlWindow method in order to pre-process the file before displaying it. I'm using a unicode version of wxPython. I don't think my problem are wxPython-specific, but rather a unicode mis-understanding. Consider the following:
. def OnLinkClicked(self, linkinfo): . #adapted from the wxPython demo . target_file = linkinfo.GetHref() . current = self.GetOpenedPage() . path = os.path.dirname(current) . print "path = ", path . print "current = ", current . print "target_file = ", target_file . filename = os.path.join(path, target_file) . print "filename = ", filename . filename = filename.replace('\\','/') . print "filename: ", filename+'\n' . self.LoadFile(filename) The first time I *click* on a link, I get the following: path = E:/Copy of rurple0.9.0.1b/rurple0.9.0.1/html/en current = E:/Copy of rurple0.9.0.1b/rurple0.9.0.1/html/en/rur.htm.html target_file = intro/browser.htm filename = E:/Copy of rurple0.9.0.1b/rurple0.9.0.1/html/en\intro/browser.htm filename: E:/Copy of rurple0.9.0.1b/rurple0.9.0.1/html/en/intro/browser.htm ... and everything is just fine (the expected file opens in the browser window). The second time I *click* on a link, I get the following (note the replacement of "E:" by "/E%3A"): path = /E%3A/Copy of rurple0.9.0.1b/rurple0.9.0.1/html/en/intro current = /E%3A/Copy of rurple0.9.0.1b/rurple0.9.0.1/html/en/intro/browser.htm.html target_file = explore.htm filename = /E%3A/Copy of rurple0.9.0.1b/rurple0.9.0.1/html/en/intro\explore.htm filename: /E%3A/Copy of rurple0.9.0.1b/rurple0.9.0.1/html/en/intro/explore.htm Traceback (most recent call last): File "E:\Copy of rurple0.9.0.1b\rurple0.9.0.1\rur_py\browser.py", line 77, in OnLinkClicked self.LoadFile(filename) File "E:\Copy of rurple0.9.0.1b\rurple0.9.0.1\rur_py\browser.py", line 54, in LoadFile data = open(filename, 'r').read() IOError: [Errno 2] No such file or directory: u'/E%3A/Copy of rurple0.9.0.1b/rurple0.9.0.1/html/en/intro/explore.htm' Any help or pointers would be appreciated... André -- http://mail.python.org/mailman/listinfo/python-list