473,796 Members | 2,585 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

iewin.IEHtmlWin dow 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.IEHtmlWin dow(self, -1, style =
wx.NO_FULL_REPA INT_ON_RESIZE)
....
fileName = 'C:\\test.pdf'

self.PDFPanel.L oadUrl(fileName )

....
# if I do this: self.PDFPanel.D estroy()
# 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.L oadUrl(C:\\Temp .pdf) which loaded fine, but
# I still got a permission denied error

shutil.move(fil eName, 'C:\\NewName.pd f')
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.L oadUrl('about:b lank') 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 3000
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.N avigate('about: blank') #Must empty pdf frame so file is
not locked
Temp_dlg = wx.MessageDialo g(self, 'Waiting for delay',
'Time delay',
wx.OK | wx.ICON_INFORMA TION
)
Temp_dlg.ShowMo dal()
Temp_dlg.Destro y()
shutil.move(fil eName, 'C:\\NewName.pd f')

Surely there is a more eloquent way to accomplish this?

Todd7 <no****@please. net> wrote in news:YUslf.7489 8$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.IEHtmlWin dow(self, -1, style =
wx.NO_FULL_REPA INT_ON_RESIZE)
...
fileName = 'C:\\test.pdf'

self.PDFPanel.L oadUrl(fileName )

...
# if I do this: self.PDFPanel.D estroy()
# 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.L oadUrl(C:\\Temp .pdf) which loaded fine, but
# I still got a permission denied error

shutil.move(fil eName, 'C:\\NewName.pd f')
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.L oadUrl('about:b lank') 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
7776
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 ---------------------------------------------------------------------------- ----------------- import re, os, time, shutil os.chdir(os.environ+os.environ+"\\Desktop") DESKTOP = os.listdir(os.environ+os.environ+"\\Desktop")
7
13975
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 new file: (I have removed most of the logic of the code here, so I am not sure it's going to be helpful)
6
3598
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 because that is what google and chm searches returned most often. My problem has to do with shutil.move actually putting the files where I ask it to. Citing code wouldn't serve any purpose, because I am using the function in the most straight...
0
1511
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 the right floated div (which is the first 125px X 125px advertisment box) appears to be displaying to the left of where it should by its width 125px plus its right margin of 10px. Note also this does not happen to the following div which has...
0
1003
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 "htmlloader.py", line 509, in load File "PythonCard\model.pyo", line 340, in __init__ File "PythonCard\resource.pyo", line 86, in __init__
6
14584
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 seems that this is the case for all my files. But what I don't understand is that yesterday it still worked. I didn't change anything on my system though (at least not that I am aware of). I restarted the computer several times to see if that...
12
4242
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 windows to open in the same window? I am running Windows XP Home. I am running ActiveState Python 2.4. Anything that I have tried has done absolutely nothing, because I can't get the events from the wx.iehtmlWindow to filter them for right clicks.
8
7636
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 it. Examine this code: This is the output: exceptions.UnicodeDecodeError
4
2603
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 have to specify the sourcefile and the destinationfile in codes and not left to be specified from the terminal. i want to be able to do this. python shutil_copy.py sourcefile, destinationfile import shutil shutil.copyfile(srcfile, dstfile)...
0
10452
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10221
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10169
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7546
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6785
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5440
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5569
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2924
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.