473,785 Members | 2,863 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 2999
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
13973
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
3597
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
1002
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
14581
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
4240
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
7633
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
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10152
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
10092
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,...
0
9950
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8974
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7500
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
5381
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
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2880
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.