Closed ScotterMonk closed 1 year ago
Does the .laccdb file remain if you simply open the connection, wait a couple of seconds, and then close the connection?
import time
import pyodbc
connection_string = "Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=…"
cnxn = pyodbc.connect(connection_string)
sleep_time = 3
print(f"Connected. Pausing for {sleep_time} seconds.")
time.sleep(sleep_time)
print("Closing connection.")
cnxn.close()
It may be a driver bug, could you post an ODBC trace? The driver is supposed to cleanup upon connection close but perhaps it isn't doing that.
Also, when you say "At end conn.close()" does it mean that your script terminates immediately after the .close()
?
Also, when you say "At end conn.close()" does it mean that your script terminates immediately after the
.close()
?
Yes and I'm trying your suggestion to put a short sleep after the close.
FWIW, I am unable to reproduce your issue with ACE for Access 2013 and an .accdb on my local hard drive. The .laccdb file is removed within one second of calling .close()
on the connection, even if the script continues to run. Is your .accdb on a network share, by chance?
Aha! Dropbox folder. BTW still have not had time to test with new pause-code you recommended.
Sincerely, Scott Swain https://OceanMedia.net
Sent with Proton Mail secure email.
------- Original Message ------- On Monday, September 25th, 2023 at 14:49, Gord Thompson @.***> wrote:
FWIW, I am unable to reproduce your issue with ACE for Access 2013 and an .accdb on my local hard drive. The .laccdb file is removed within one second of calling .close() on the connection, even if the script continues to run. Is your.accdb on a network share, by chance?
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>
Environment:
My issue:
Open database, read & write <-- all works fine. At end conn.close() .Laccdb file (MS Access lock file) stays visible in folder next to the .accdb file. It's not a "slow" thing. I refresh, wait, etc. and that .Laccdb file is still there. I can delete it manually but would like this to work the way it is supposed to. Until I can figure out an elegant fix, I'll have my program delete the file.