Update: I have found that if I delay the time between when I load a new url into IEHtmlWindow and then do the shutil.move it works fine. Such as:
self.PDFPanel.Navigate('about:blank') #Must empty pdf frame so file is not locked Temp_dlg = wx.MessageDialog(self, 'Waiting for delay', 'Time delay', wx.OK | wx.ICON_INFORMATION ) Temp_dlg.ShowModal() Temp_dlg.Destroy() shutil.move(fileName, 'C:\\NewName.pdf') Surely there is a more eloquent way to accomplish this? Todd7 <[EMAIL PROTECTED]> wrote in news:YUslf.74898$2k5.73363 @dukeread09: > I am writing a python program to load a pdf file into an IEHtmlWindow > which displays it through adobe acrobat reader 7. Depending on the > buttons the user clicks, the program moves it to another subdirectory > with a new name. I am using python 2.4 with wxpython 2.6 on a windowsxp > machine. > > I encounter a permission denied error when trying to move the file. It > appears to be caused due to the loading of the pdf file into the > IEHtmlWindow. The program is too long to post here, but below are some > snippets of the code. > > self.PDFPanel = iewin.IEHtmlWindow(self, -1, style = > wx.NO_FULL_REPAINT_ON_RESIZE) > ... > fileName = 'C:\\test.pdf' > > self.PDFPanel.LoadUrl(fileName) > > ... > # if I do this: self.PDFPanel.Destroy() > # then the following shutil.move works > # else I get a [Errno 13] Permission denied: 'C:\\test.pdf' > # tried loading another pdf file before doing shutil.move > # like: self.PDFPanel.LoadUrl(C:\\Temp.pdf) which loaded fine, but > # I still got a permission denied error > > shutil.move(fileName, 'C:\\NewName.pdf') > > > As stated in the comments above, if I destroy the IEHtmlWindow, then the > move works fine. I do not want to destroy it because I want to continue > using it to load the next pdf file to work on renaming. I tried > self.PDFPanel.LoadUrl('about:blank') before the shutil.move command. > The window displayed a blank screen, but still the permission denied > error. I then tried loading a different pdf file into the window, then > doing the shutil.move on the first pdf, but still the permission denied > error. If I destroy the window before the shutil.move command, then it > works fine, but I need the IEHtmlWindow for other work. > > Any suggestions on how to get the IEHtmlWindow to let go of the pdf file > before the shutil.move command without destroying the IEHtmlWindow all > together? > > Thanks, > Todd. > -- http://mail.python.org/mailman/listinfo/python-list