Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > iewin.IEHtmlWindow shutil.move conflict

Reply
Thread Tools

iewin.IEHtmlWindow shutil.move conflict

 
 
Todd7
Guest
Posts: n/a
 
      12-07-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.
 
Reply With Quote
 
 
 
 
Todd7
Guest
Posts: n/a
 
      12-07-2005
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 <(E-Mail Removed)> 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.
>


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
css conflict (or html conflict) charles cashion HTML 2 02-18-2009 09:41 PM
NIS and dynamic IP conflict Deborah Harper Wireless Networking 0 11-09-2004 08:38 PM
ip conflict Headtheball Wireless Networking 1 09-06-2004 10:49 PM
Re: Firewire card creates dial-up internet access conflict. Dead Meat Wireless Networking 0 09-02-2004 01:15 AM
IP conflict Neil Holmes Wireless Networking 1 08-06-2004 06:39 PM



Advertisments