iewin.IEHtmlWindow shutil.move conflict

Todd7 nospam at please.net
Tue Dec 6 22:44:56 EST 2005


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.



More information about the Python-list mailing list