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. 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. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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
...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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
|
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...
|
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,...
|
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,...
|
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...
|
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...
|
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,...
|
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...
| |