473,396 Members | 2,033 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

iewin.IEHtmlWindow shutil.move conflict

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.
Dec 7 '05 #1
1 2969
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 <no****@please.net> 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.


Dec 7 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: bmgz | last post by:
I am have made a simple script that moves all desktop clutter (ie files that are not *.lnk) to a specified folder eg. c:\myhome\mydocs\desktopdebris\2003-12-16 ...
7
by: Stéphane Ninin | last post by:
Hello world, I am fighting with what is probably a stupid problem. In a wxpython GUI, here is a method which must read a file, and if the file is not correctly formed rename it and create a...
6
by: Daniel Bickett | last post by:
Hello, I'm writing an application in my pastime that moves files around to achieve various ends -- the specifics aren't particularly important. The shutil module was chosen as the means simply...
0
by: David Ehmer | last post by:
The site below is having IEwin problems with a right floated div. This div is nested within another div - 'content', which itself is nested with a div - 'center_container'. From what I can tell...
0
by: gjzusenet | last post by:
Hi I've been using an IEHtmlWindow in my script with no problems, but it seems that for people with a clean installation of XP SP2 it fails like such: Traceback (most recent call last): File...
6
by: Antoine De Groote | last post by:
Google tells quite some things about it, but none of them are satisfactory. I'm on Windows, and shutil operations (e.g. move, copy) throw Permission denied all the time, for the source files. It...
12
Subsciber123
by: Subsciber123 | last post by:
I have a window that I have created using Python Card that contains an wx.iehtmlWindow opject inside of it. Does anyone know how to disable right click and/or cause links that would open in new...
8
by: David Nicolson | last post by:
Hi, I wasn't exactly sure where to send this, I don't know if it is a bug in Python or not. This is rare, but it has occurred a few times and seems to be reproducible for those who experience...
4
by: klia | last post by:
hello folks i am trying to tweak the current codes so that later when i call it from the terminal i can provide sourcefile and the destination file rather being fixed in the code. because now i...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.