I'm banging my head over this one... sometimes it just works... *argh*<br><br>Here's a snip of my problem:<br><br>import win32com.client<br>import shutil<br>import time<br><br>engine = win32com.client.Dispatch("
DAO.DBEngine.36")<br>table = 'STUFFTODELETE'<br>dstFilename = 'in.mdb'<br>workingfile = 'work.mdb'<br><br>shutil.copyfile(dstFilename, workingfile)<br><br>print 'Sleeping 5 after copy...'
<br>time.sleep(5)<br>    <br>dstDb = engine.OpenDatabase(workingfile)<br>    <br>print 'Sleeping 5 after open...'<br>time.sleep(5)<br><br> dstDb.Execute('DELETE FROM ' + table)<br><br>At at *exactly* this line, I get the error:
<br>
<br>C:\Python24\lib\site-packages\win32com\gen_py\00025E01-0000-0000-C000-000000000046x0x5x0.py    510    <br>com_error: (-2147352567, 'Exception occurred.', (0, 'DAO.Database', 'Not a valid bookmark.', '
jeterr40.chm', 5003159, -2146825129), None)            <br><br>Sometimes... Yes, the database is a %"#$"# MSAccess. This script is running under windows.<br><br>Any ideas?<br><br><div><span class="gmail_quote">
On 1/31/07, <b class="gmail_sendername">Hugo Ferreira</b> <<a href="mailto:bytter@gmail.com">bytter@gmail.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<span class="q">Well.. Thx for the answers.<br><br>The only way I had to make it work
was to use a time.sleep(10) after the shutil.copyfile(). Since this is
a night-run script, I can waste 10 seconds, but it still knocks me out
"why" it happens...<br><br></span>Cheers!<br><span class="sg"><br>Hugo Ferreira<br><br></span><div><span class="q"><span class="gmail_quote">On 30 Jan 2007 18:06:15 +0000 (GMT), <b class="gmail_sendername">Matthew Woodcraft
</b> <<a href="mailto:mattheww@chiark.greenend.org.uk" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
mattheww@chiark.greenend.org.uk</a>> wrote:</span></span><div><span class="e" id="q_11075b4751ec6a1c_5"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hugo Ferreira <<a href="mailto:bytter@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
bytter@gmail.com</a>> wrote:<br>> I have a problem. I'm using calling shutil.copyfile() followed by<br>> open(). The thing is that most of the times open() is called before<br>> the actual file is copied. I don't have this problem when doing a
<br>> step-by-step debug, since I give enough time for the OS to copy the<br>> file, but at run-time, it throws an exception.<br>><br>> Is there anyway to force a sync copy of the file (make python wait for<br>

> the completion)?<br><br>shutil.copyfile() closes both files before it returns, so I suspect<br>this is an OS-level bug.<br><br>The most likely culprits are buggy network filesystems and buggy<br>on-access virus scanners.
<br><br>-M-<br><br>--<br><a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://mail.python.org/mailman/listinfo/python-list</a><br></blockquote>
</span></div></div><br>

</blockquote></div><br>