Error loading files in StyledTextCtrl. help!

I'm creating a muti file editor i trying to load files but i have
little troubles for do that here is the code that i'm using to load
files i'm using a Notebook to load multiple files inside using
StyleTextCtrl instance for each.

also i want know for save them. how tell to the dialog, which file is
what i want to save?

def OnOpenFile(self, event):
        dlg = wx.FileDialog(self, "Open python File",self.dirName,
self.filename,
                            "Python Files (*.py)|*.py|Text
Files(*.txt)|*.txt|All Files (*.*)|*.*", wx.OPEN)
        dlg.Center()
        if dlg.ShowModal() == wx.ID_OK:
            self.filename = dlg.GetFilename()
            self.dirName = dlg.GetDirectory()
            '''path = self.dlg.GetPath()
            self.file.LoadFile(path)
            self.filename = self.dlg.GetFilename()
            self.mainntbk.AddPage(self.file,
""+self.dlg.GetFilename())'''
            try:
                f = file(os.path.join(self.dirName, self.filename),
'r')
                #f = dlg.GetPath()
                self.file = editor.EditorPanel(self.mainntbk, -1)
                self.file.LoadFile(f.read())
                self.mainntbk.AddPage(self.file,
""+self.dlg.GetFilename())
                self.SetTitle(APP_NAME + " -["+ self.filename+"]")
                f.close()
            except:
                self.PushStatusText("Error in open file.", SB_INFO)
        dlg.Destroy()

the error is a dialog box that says "can't open file
'textinsidefile' (error 2:the system can not find the file specified)"

the file has loaded in the STC before that use that code, I've used
this code to load it, and it worked
if....
            path = self.dlg.GetPath()
            self.file.LoadFile(path)
            self.filename = self.dlg.GetFilename()
            self.mainntbk.AddPage(self.file,
""+self.dlg.GetFilename())

I've used the GetPath() instead file(os.path.join(x, x), x)

what is the problem here?