dimanche 19 avril 2015

MS Access application opened from Python script can't quit if Tk() loop is called

I have stucked with a specific problem. I am working on Python script which reads data from MS Access database (.mdb) using VBA API and displays it in GUI tables using tkintertable module.


The problem is that after script terminates the MSACCESS.exe process is keeping alive in the process list.


When I comment mainloop() method for the root window the problem disappears.


Explicit call of access.quit() does not solve the problem. It makes it worse: the script terminates, but the MS Access process makes visible, I see it's window, but can't close it, because it appears more and more.


I removed all the unnecessary lines from the code to localize the problem:



#!C:\Python343\python
from comtypes.client import CreateObject
from tkinter import *

access = CreateObject('Access.Application')

root = Tk()
root.mainloop() # if I comment this line, everything works
# access.quit() - does not help: MS Access window gets visible and immortal
#


Can one give any clue of why this happens? Thanks in advance for any advice.


Python version: 3.4.3. MS Office: 2013.


Aucun commentaire:

Enregistrer un commentaire